Searching a project with silver searcher

Really basic question:

How do I search a project with Silver Searcher from within vim? In the old days when I used Sublime, it was a simple command-shift-f, but in the Vim world, nothing is simple for us newcomers.

Install GitHub - epmatsw/ag.vim: Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'. Then you can search with :Ag.

1 Like

I like to use ag as my grepprg.

cnoreabbrev ag grep
if executable("ag")
  set grepprg=ag\ --nogroup\ --nocolor\ --column

Then a command like :grep initialize will use ag instead of grep.

You might also want this which will automatically open the search results in the QuickFix window:

autocmd QuickFixCmdPost *grep* cwindow

Some (or all) of this might be available from ag.vim, but, personally, I don’t see the point of adding more plugins than I have to, and these commands work perfectly well for my purposes.