vimtricks.wiki Concise Vim tricks, one at a time.

How do I append another pattern search to the current quickfix results?

Answer

:vimgrepadd /FIXME/j **/*.go

Explanation

When you are triaging a codebase, one pattern is rarely enough. :vimgrepadd lets you accumulate matches into the same quickfix list instead of replacing the previous search each time, so you can build a working set across multiple queries in one pass. This is especially useful during refactors, bug hunts, or review prep where related markers live under different tokens.

How it works

  • :vimgrepadd runs a new Vim regex search and appends results to quickfix
  • /FIXME/ is the pattern (any Vim regex works)
  • j suppresses "pattern not found" errors for files with no matches
  • **/*.go expands recursively to target files

Unlike :vimgrep, this command preserves earlier quickfix entries. You can run several :vimgrepadd commands in a row (for example TODO, FIXME, and HACK) and navigate everything from one list.

Example

Start with an existing quickfix list from a first search:

TODO matches in pkg/a.go and pkg/b.go

Then append another pass:

:vimgrepadd /FIXME/j **/*.go

Now quickfix contains both sets:

TODO and FIXME matches together in one navigable list

Tips

  • Use :copen, :cnext, and :cprev to review the combined queue quickly.
  • If you want a fresh list again, run plain :vimgrep for the next search.

Next

How do I launch a GDB session in Vim with the built-in termdebug plugin?