mardi 7 octobre 2014

New option added to Ag the silver searcher

Ag the silver searcher has now an option named --vimgrep and will behave like :vimgrep /pattern/g file in vim: it reports every match on the line. Ag --column could bring vim to the exact first match location, --vimgrep takes you to every match location on the line.

Here's a ~/.vimrc configuration example:

  set grepprg=ag\ --vimgrep\ $*
  set grepformat=%f:%l:%c:%m

Then use :grep to grep for something.
Then use :copen :cn :cp etc.. to navigate through the matches.

This animated gif will show your how it works.