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

How do I temporarily narrow quickfix entries by pattern using the cfilter plugin?

Answer

:packadd cfilter | Cfilter /ERROR/

Explanation

Quickfix lists can get noisy in large projects, especially when one grep or compiler run mixes several classes of issues. The cfilter plugin gives you a focused subview without rebuilding quickfix from scratch. Using :packadd cfilter | Cfilter /ERROR/ loads the plugin on demand, then filters the current quickfix list to entries matching your pattern. This keeps your current workflow state while letting you zero in on one problem type.

How it works

  • :packadd cfilter ensures the standard runtime plugin is loaded for this session
  • | chains the next Ex command
  • Cfilter /ERROR/ keeps only quickfix items whose text matches ERROR

This is a strong fit when quickfix is already populated (from :make, :grep, or :vimgrep) and you need targeted triage instead of another full search pass.

Example

Start with a quickfix list containing mixed diagnostics:

ERROR, WARNING, NOTE entries from many files

Run:

:packadd cfilter | Cfilter /ERROR/

After filtering:

Only ERROR entries remain in quickfix

Tips

  • Use Lfilter for the location list equivalent when working window-locally.
  • Treat this as a temporary focus lens; regenerate quickfix when you need the full set again.

Next

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