/dev/blog
Bez Hermoso, Software Engineer @ Square
Unlike in Ag.vim
, fzf.vim
’s :Ag
command does not provide the ability to specify additional options to use with The Silver Searcher a.k.a. ag
. Unfortunately, fzf
does not use --exclude-vcs-ignores
by default despite it being useful for programmers i.e. search file contents under a vendor directory or a mount, for example.
The way to do it in fzf.vim
is to create a custom command that will pass the -U|--exclude-vcs-ingores
to the underlying ag
call:
command! -bang -nargs=* Agu call fzf#vim#ag(<q-args>, '--skip-vcs-ignores', {'down': '~40%'})
With this in ~/.vimrc
, it is now possible to search the contents of a project by using :Agu
instead of :Ag
. The search will no longer ignore files that are in .gitignore
or any other VCS ignore lists.
See The Silver Searcher and
fzf.vim
.