- Published on
searching through multiple files with vim
- Authors

- Name
- Peter Peerdeman
- @peterpeerdeman
Just as a reminder to myself and to everyone looking for a short and easy answer to get a quick vim project search going:
brew install the_silver_searcher(this is an amazingly fast file searcher)- download and configure the vim ack plugin
- enter the following code in vimrc file to enable ag as default for ack
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
:Ack TIMESTAMPto find the word TIMESTAMP in any file in the current directory:cnfor next and:cpfor previous hit- install vim-unimpaired for access to shortkeys
[qand]qfor jumping through hits
fallback
Ofcourse, you could also use vimgrep which will work without installing any plugins but is a lot slower:
:vimgrep <searchterm> **/*.<fileextension>
- e.g.
:vimgrep TIMESTAMP *.*to find the word TIMESTAMP in any file in the current directory - e.g.
:vimgrep /\v\d{5}/g **/*.mdto recursively find all 5 number strings in any markdown file in the current project