How do you do incremental search across multiple files in VIM?

Vim is already doing an incremental search on the currently open file, but can you do an incremental search on multiple files?

+6
vim
source share
2 answers

AFAIK is impossible. However, you can start typing a word that is in an open buffer and press ctrl-x ctrl-n to start searching for that word in all open buffers.

+1
source share

from :help grepadd

  *:grepa* *:grepadd* :grepa[dd][!] [arguments] Just like ":grep", but instead of making a new list of errors the matches are appended to the current list. Example: > :call setqflist([]) :bufdo grepadd! something % The first command makes a new error list which is empty. The second command executes "grepadd" for each listed buffer. Note the use of ! to avoid that ":grepadd" jumps to the first error, which is not allowed with |:bufdo|. An example that uses the argument list and avoids errors for files without matches: > :silent argdo try \ | grepadd! something % \ | catch /E480:/ \ | endtry" 
-one
source share

All Articles