vimtricks.wiki Concise Vim tricks, one at a time.

How do I fuzzy-search and run any available Vim command using fzf.vim?

Answer

:Commands

Explanation

fzf.vim's :Commands opens an interactive fuzzy picker over every Ex command that Vim currently knows — built-ins, plugin-defined commands, and your own user commands. You can type to filter, preview the command definition, and press <CR> to execute it (or <C-x> to insert it at the command line without running).

How it works

  • Requires the fzf and fzf.vim plugins to be installed
  • :Commands collects the output of :command and presents it through fzf's filtering UI
  • Each entry shows the command name and its definition or source
  • Pressing <CR> on a selection places the command on the command line, ready to run (or with a count/bang if you add it first)

Example

You vaguely remember there's a :Git... command from vim-fugitive but can't recall the exact name:

:Commands

Type git in the fzf prompt — all Git* commands appear immediately. Select :Gitsigns preview_hunk or :Gdiffsplit and press <CR>.

Tips

  • Pair with :Maps (also from fzf.vim) to fuzzy-search all current keymappings — invaluable for discovering plugin bindings
  • :Helptags lets you fuzzy-search Vim help tags, and :Help opens the matching help entry directly
  • You can bind :Commands to a leader key: nnoremap <leader>fc :Commands<CR>
  • The complementary :History: fuzzy-searches your command-line history, while :History/ searches your search history

Next

How do I copy files to a target directory using netrw's marking system?