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

How do I enable :Cfilter and :Lfilter commands without a plugin manager?

Answer

:packadd cfilter

Explanation

Vim ships with useful optional runtime plugins that many users never load. One of the most practical is cfilter, which adds :Cfilter and :Lfilter so you can quickly narrow quickfix or location-list entries with a regex. If you use :vimgrep, :make, or LSP diagnostics routed into quickfix, loading cfilter gives you a fast way to isolate only the errors you care about.

How it works

  • :packadd cfilter loads the built-in cfilter package from your runtime packages
  • After loading, :Cfilter /pat/ filters the current quickfix list
  • :Lfilter /pat/ does the same for the current location list

This is especially handy in large result sets where a full rerun of search or build would be slower than filtering what you already have.

Example

Suppose your quickfix list contains mixed diagnostics:

app.go:12: warning: shadowed variable
api.go:44: error: nil pointer dereference
db.go:88: warning: unchecked error
main.go:101: error: missing return

Load the plugin and keep only errors:

:packadd cfilter
:Cfilter /error:/

Now the list is reduced to only error entries, so you can iterate with :cnext more efficiently.

Tips

  • Use :Cfilter! /pat/ to invert the filter (remove matching entries)
  • Keep this in your config if you rely on quickfix workflows often
  • Works in plain Vim/Neovim runtime package systems, no external plugin manager required

Next

How do I append the same suffix to every selected line in Visual mode?