Skip to content

fzf.vim

FZF is general purpose command line fuzzy finder, and fzf.vim is the vim companion.

Resources

:GFiles

Wrapper for git ls-files. Very handy when only dealing with files associated with git.

:Files

General purpose search. Uses FZF_DEFAULT_COMMAND environment variable under the hood. I'm using fd for general search, since it respects .gitignore.

Search only certain filetype

:Rg -t py breakpoint

Modifications

Use ripgrep with live preview:

From https://github.com/junegunn/fzf.vim#example-advanced-ripgrep-integration

function! RipgrepFzf(query, fullscreen)
  let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
  let initial_command = printf(command_fmt, shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}')
  let spec = {'options': [:fontawesome-solid-link: '--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction

command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)