From a50815d4ea872b8f02987f13a03a83805b570af9 Mon Sep 17 00:00:00 2001 From: Guangxiong Lin Date: Wed, 13 Apr 2022 09:51:35 +0800 Subject: Load fzf plugin only when fzf exists (vim) --- .vim/after/plugin/fzf.vim | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to '.vim') diff --git a/.vim/after/plugin/fzf.vim b/.vim/after/plugin/fzf.vim index cda5a27..e041d6b 100644 --- a/.vim/after/plugin/fzf.vim +++ b/.vim/after/plugin/fzf.vim @@ -1,22 +1,24 @@ -let g:fzf_command_prefix = 'Fzf' +if executable('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 -- '.shellescape(), 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 -- '.shellescape(), 1, + \ fzf#vim#with_preview(), 0) -noremap ff :FzfFiles -noremap fgf :FzfGFiles -noremap fb :FzfBuffers -noremap fm :FzfHistory -noremap ft :FzfBTags -noremap fT :FzfTags -noremap fa :FzfAg -noremap fr :FzfRg -noremap fc :FzfCommands -noremap fgc :FzfBCommits -noremap fgC :FzfCommits -noremap fl :FzfBLines -noremap fL :FzfLines + noremap ff :FzfFiles + noremap fgf :FzfGFiles + noremap fb :FzfBuffers + noremap fm :FzfHistory + noremap ft :FzfBTags + noremap fT :FzfTags + noremap fa :FzfAg + noremap fr :FzfRg + noremap fc :FzfCommands + noremap fgc :FzfBCommits + noremap fgC :FzfCommits + noremap fl :FzfBLines + noremap fL :FzfLines -packadd fzf.vim + packadd fzf.vim +endif -- cgit v1.2.3