Vim Quickfix List
Published Wed Jan 31 2024While using Vim for a while now I have had the quickfix list open by accident many times. Usually holding a set of files I actually do want to look at, but I didn’t know how to interact with this list. Pressing return on a file didn’t open it and I didn’t know what it was. In these moments I was in the middle of completing work, opting to navigate to these files through other means rather than sitting down and learning to use it. Don’t skip over learning to use this like I did! Quickfix is very powerful and you can read about it with :h quickfix
. Here are the basics though:
What is it?
Quickfix was designed to tighten your “edit-compile-edit” workflow. It was originally designed to be populated by compiler errors to allow you to edit each one in succession instead of fixing a single file before returning to the compiler for more information. One modern method of populating a quickfix list is Telescope. In Telescope windows <C-q>
will take the results of your query and send them to the quickfix list. Here is what my quickfix looks like after searching my personal site for Content
:
Once populated you can begin stepping through the list. This is done using :cn
or :cnext
which will open the file in a new buffer and place your cursor on the specified line. cp
or cprevious
is used to move backwards.