Guide · Open source
How to use fzf.vim: commands, install and tips
Updated · written with AI from the project's own documentation and checked against our catalogue data
fzf.vim is a plugin for Vim that adds ready-made fuzzy search commands such as :Files, :Buffers and :Rg, each of which opens the fzf fuzzy finder. This guide is for Vim or Neovim users who want fuzzy file, buffer and line search without writing their own Vimscript. By the end you will know how to install it, run the main commands and adjust a few settings.
Quick start
- 1Check prerequisites. Confirm you have Vim or Neovim, a plugin manager such as vim-plug, and fzf 0.54.0 or above.
- 2Add the plugins. Add the two Plug lines for junegunn/fzf and junegunn/fzf.vim to your vimrc.
- 3Install the plugins. Run the plugin install from inside Vim so both fzf and fzf.vim are set up.
- 4Install optional tools. Add ripgrep, The Silver Searcher, bat or Perl if you want the commands that need them.
- 5Run a command. Open Vim and run :Files, then type a few characters to filter the list and press Enter.
- 6Try Rg and Buffers. Run :Rg with a pattern to search file contents, and :Buffers to switch between open buffers.
- 7Adjust the preview. Set g:fzf_vim.preview_window in your vimrc to change or hide the preview window.
What do you need before installing fzf.vim?
fzf.vim depends on the basic Vim plugin from the main fzf repository, so you need to set up both fzf and fzf.vim. The plugin requires fzf 0.54.0 or above, and it runs only inside Vim or Neovim.
Some commands need extra programs. Rg requires ripgrep (rg), Ag requires The Silver Searcher (ag), and Tags and Helptags require Perl. For a syntax-highlighted preview, install bat.
- fzf 0.54.0 or above
- Vim or Neovim with a plugin manager such as vim-plug
- Optional: bat for syntax-highlighted preview
- Optional: ripgrep (rg) for :Rg, The Silver Searcher (ag) for :Ag
- Optional: delta, which GF?, Commits and BCommits use to format git diff output if available
brew install fzf bat ripgrep the_silver_searcher perl universal-ctagsHow do you install fzf.vim with vim-plug?
The README shows installation with vim-plug. Add the two lines below to your vimrc, then run the plugin install from inside Vim. The first line installs fzf and runs fzf#install() to make sure you have the latest binary. That hook is optional, so you can leave it out if your plugin manager does not support hooks.
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'Which commands does fzf.vim provide?
Each command opens a list in fzf. Type a few characters to filter the list, then press Enter to open the selected item. Commonly used commands include :Files for files, :Buffers for open buffers, :GFiles for git-tracked files, :Rg for ripgrep search results, :Lines for lines in loaded buffers and :BLines for lines in the current buffer.
Other useful commands include :History for recently opened files and buffers, :Commits for git commits (this needs fugitive.vim), :Marks, :Windows and :Maps.
- :Files [PATH]: files, using $FZF_DEFAULT_COMMAND if it is defined
- :GFiles [OPTS]: git files from git ls-files
- :GFiles?: git status output
- :Buffers: open buffers
- :Ag [PATTERN] and :Rg [PATTERN]: ag or rg search results
- :RG [PATTERN]: ripgrep, relaunched on every keystroke
- :Lines [QUERY] and :BLines [QUERY]: lines in loaded buffers or the current buffer
- :Tags [PREFIX] and :BTags [QUERY]: tags in the project or current buffer
- :Commits [LOG_OPTS] and :BCommits [LOG_OPTS]: git commits, the second for the current buffer
- :History, :History: and :History/: files, command history and search history
What keys work inside the fzf list?
Most commands share the same key bindings. CTRL-T, CTRL-X and CTRL-V open the selected item in a new tab, a horizontal split or a vertical split. ALT-ENTER inserts the selected items into the current buffer instead of opening them. The text inserted depends on the command: a file path for :Files, a line for :Lines, matched text for :Rg, a tag name for :Tags or a commit hash for :Commits.
Ag and Rg commands support ALT-A to select all results and ALT-D to deselect all. Adding a bang, such as Ag!, opens fzf in fullscreen.
- CTRL-T, CTRL-X, CTRL-V: open in a new tab or split
- ALT-ENTER: insert the selected item into the current buffer
- ALT-A / ALT-D on :Ag and :Rg: select or deselect all results
- Bang versions such as Ag! open fzf fullscreen
How do you change the preview window?
Some commands show a preview on the right. Set the g:fzf_vim dictionary before you assign any options to it, because all fzf.vim settings are stored there. The default shows the preview on the right at 50% width, toggled with CTRL-/. You can hide it by default or disable it with an empty list.
On Windows, fzf.vim looks for bash in your PATH and then for Git bash. If you need a different bash, set g:fzf_vim.preview_bash.
- Set g:fzf_vim.preview_window to ['right,50%', 'ctrl-/'] for the default
- Use [] to disable the preview window altogether
- Use g:fzf_vim.command_prefix = 'Fzf' to get commands such as FzfFiles
let g:fzf_vim = {}
let g:fzf_vim.preview_window = ['hidden,right,50%,<70(up,40%)', 'ctrl-/']How do you use fzf.vim day to day?
Start with :Files to open a file by typing part of its path. Use :Buffers to switch between open files, or :Rg to search file contents and jump to a match. In a git repository, :GFiles lists tracked files and :Commits helps you browse history.
If the list is short, the speed gain from fzf may not be noticeable, since the README says the benefit can be small for small inputs. That does not stop the commands from being useful for finding things quickly.
What people use it for
- Open a file in a large project by typing part of its name with :Files
- Switch between open buffers with :Buffers
- Search file contents with ripgrep and jump to a match using :Rg
- Browse git commits for the current file with :BCommits
- Insert a selected file path or matched text into the current buffer with ALT-ENTER
Frequently asked questions
Is fzf.vim free to use?
fzf.vim is released under the MIT licence, according to the project's listing. The licence allows you to use it as part of your Vim setup.
What do I need to install before fzf.vim?
You need fzf 0.54.0 or above and Vim or Neovim with a plugin manager such as vim-plug. The README says you must set up both fzf and fzf.vim.
Does fzf.vim work outside Vim?
No. The plugin only runs inside Vim or Neovim. If you want fzf without Vim, you need to set up fzf separately.
Why does :Rg not work?
The :Rg command requires ripgrep (rg). Install ripgrep and make sure it is available on your system before running the command.
How is fzf.vim different from ctrlp.vim or telescope.nvim?
The source lists ctrlp.vim, telescope.nvim and fzf-lua as comparable projects but does not compare their features or speed. fzf.vim is built on fzf and gives ready-made commands for files, buffers, lines and git history.
Can I change the command names?
Yes. Set g:fzf_vim.command_prefix, for example to 'Fzf', and the commands get that prefix, such as FzfFiles.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
fzf.vim suits Vim or Neovim users who already use fzf or want ready-made fuzzy search for files, buffers, lines and git history without writing Vimscript. It is not useful if you do not use Vim, want fzf alone, or only search small lists where the speed gain may not be noticeable; in those cases consider a different tool.
Install options & downloads