This answer is based on https://stackoverflow.com/a/11976158/1057593.
However, I wanted add a few bits. Again the basic command is
:bufdo vimgrepadd pattern %
If your quickfix list is not empty, you probably want to clear it first (see https://stackoverflow.com/q/27385970/1057593). This can be done with
vim-unimpaired provides the mappings
[q to cycle through the matches.
It is a good workflow to enter the search pattern separately with
/pattern. This allows you to use a generic command from your commandline history using the current search pattern. This would look like
:bufdo vimgrepadd // %
A typical new buffer wide search would be
I have added following mappings to my vimrc to use
<C-P> instead of the arrow keys
cmap <C-P> <Up>
cmap <C-N> <Down>
To search the command history use
/bufdo<CR> and invoke a command with
<CR>. For more details see https://vim.fandom.com/wiki/Using_command-line_history and the help pages
:h history and
You can add to the reusable command
:copen to immediately see the quickfix list in the following way:
:execute "bufdo vimgrepadd // %" | copen
The proposal from stackoverflow
:bufdo vimgrepadd // % | copen opened several unintended windows in my case.