I'm using (the fantastic) Ag, Silver Searcher, through (the fantastic) fzf.vim plugin. When I search for text, though, I don't want to see matches on file names.

For example,

:Ag finder

shows every line in every file that has the word finder in it, when all I want is the files that actually have the word finder in them.

  • How about --[no]filename?
    – Tuyen Pham
    Nov 15, 2017 at 19:04

1 Answer 1


To find files which contains some string, the :grep command is "for that". And I know it's quite slow.

For that purpose, I have added the :Find command to my .vimrc: (From this post)

command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --no-ignore --hidden --follow --glob "!.git/*" --color "always" '.shellescape(<q-args>), 1, <bang>0)

Note that with --fixed-strings we don't have to quote the string so we theoretically should just do :Find a string with space

By the way I am also using set grepprg=rg\ --vimgrep so instead of the original slow :grep or :Ag, I can use :grep finder to find files that contains the word "finder", powered by rg.

And use :Ag (or :FZF) to find files that has "finder" in their names.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.