How to enable AG in vim + fzf

odbhut.shei.chhele picture odbhut.shei.chhele · Mar 1, 2018 · Viewed 13.1k times · Source

I am new to vim. I read online that one of the best fuzzy finder in vim is fzf. I have started using it. But whenever I write the command :Ag I get ag is not found. I don't know what it means and I don't know how to fix it.

Answer

nbari picture nbari · Mar 1, 2018

You need to install ag, in case you are on a mac:

brew install the_silver_searcher

As another option for testing fzf you could also use ctrl p to call :Files by using this map:

nnoremap <c-p> :Files<CR>

And you could use ripgrep when calling :Files, for this you will need to modify the default FZF_DEFAULT_COMMAND:

export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow --glob "!.git/*"'

You can find more information here: https://github.com/junegunn/fzf#usage