From 7ed1a02d83402b0090086d8a88444b552ebf0afb Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Fri, 3 Nov 2023 20:06:29 +0800 Subject: Update fzf vim config --- .vim/after/plugin/fzf.vim | 63 ++++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/.vim/after/plugin/fzf.vim b/.vim/after/plugin/fzf.vim index 0694caa..648cb54 100644 --- a/.vim/after/plugin/fzf.vim +++ b/.vim/after/plugin/fzf.vim @@ -1,3 +1,7 @@ +if !executable('fzf') + finish +endif + let s:fzf_default_opts = $FZF_DEFAULT_OPTS function! s:build_quickfix_list(lines) abort @@ -38,39 +42,36 @@ command! FzfQuickFix call fzf#run({ \ 'options': s:fzf_default_opts. ' --multi --prompt "QuickFix> "' \ }) -if executable('fzf') && get(g:, 'loaded_fzf', 0) == 1 - let g:fzf_command_prefix = 'Fzf' +let g:fzf_command_prefix = 'Fzf' - command! -bang -nargs=* FzfRg - \ call fzf#vim#grep( - \ 'rg --hidden --column --line-number --no-heading --color=always --smart-case --glob !.git ' . , 1, - \ fzf#vim#with_preview(), 0) +command! -bang -nargs=* FzfRg + \ call fzf#vim#grep( + \ 'rg --hidden --column --line-number --no-heading --color=always --smart-case --glob !.git ' . , 1, + \ fzf#vim#with_preview(), 0) - command! FzfGitChangedFiles call fzf#run({ - \ 'source': s:command_git_patch_files_changed, - \ 'sink': 'e' - \ }) +command! FzfGitChangedFiles call fzf#run(fzf#wrap({ + \ 'source': s:command_git_patch_files_changed, + \ 'sink': 'e' + \ })) - noremap ff :FzfFiles - noremap fgf :FzfGFiles - noremap fb :FzfBuffers - noremap fm :FzfHistory - noremap ft :FzfBTags - noremap fT :FzfTags - noremap fr :FzfRg - noremap fc :FzfCommands - nnoremap fC :FzfGitChangedFiles - noremap fgc :FzfBCommits - noremap fgC :FzfCommits - noremap fl :FzfBLines - noremap fL :FzfLines - noremap fq :FzfQuickFix +noremap ff :FzfFiles +noremap fgf :FzfGitChangedFiles +noremap fb :FzfBuffers +noremap fm :FzfHistory +noremap ft :FzfBTags +noremap fT :FzfTags +noremap fr :FzfRg +noremap fc :FzfCommands +noremap fgc :FzfBCommits +noremap fgC :FzfCommits +noremap fl :FzfBLines +noremap fL :FzfLines +noremap fq :FzfQuickFix - let g:fzf_action = { - \ 'ctrl-q': function('s:build_quickfix_list') - \ } - let g:fzf_layout = { 'down': '40%' } - let g:fzf_preview_window = [ 'right:80%:hidden', 'ctrl-/' ] +let g:fzf_action = { + \ 'ctrl-q': function('s:build_quickfix_list') + \ } +let g:fzf_layout = { 'down': '40%' } +let g:fzf_preview_window = [ 'right:80%:hidden', 'ctrl-/' ] - packadd fzf.vim -endif +packadd fzf.vim -- cgit v1.2.3