Skip to content

Commit

Permalink
fix(vim): E492: Not an editor command: FZF (#58)
Browse files Browse the repository at this point in the history
Explicitly read Ex commands from the fzf.vim plugin and check `FZF`
command existence before adding a key map to avoid an issue when fzf is
located in the path, the plugin is absent from the runtime path but the
keymap is set anyway.
  • Loading branch information
kirillmorozov authored Jul 5, 2024
1 parent c12b0e2 commit e91cad4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vim/.vimrc
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,15 @@ endif

" If fzf is available use its built-in Vim plugin for file navigation
if executable("fzf")
set rtp+=/opt/homebrew/opt/fzf
set rtp+=~/.fzf
nnoremap <leader>f :FZF<CR>
set rtp+=/opt/homebrew/opt/fzf " for macOS and fzf installed via brew
set rtp+=/usr/share/doc/fzf/examples " for Debian and fzf installed via apt
" NOTE(kirillmorozov): fzf.vim might not exist in the runtimepath so I
" explicitly read Ex commands from the plugin and check FZF command
" existence before adding a key map.
runtime plugin/fzf.vim
if exists(':FZF') == 2
nnoremap <leader>f :FZF<CR>
endif
endif

" Set up Git TUI client
Expand Down

0 comments on commit e91cad4

Please sign in to comment.