Qftools.vim
Tools to manipulate the quickfix window
Install / Use
/learn @AndrewRadev/Qftools.vimREADME
Usage
This plugin provides various commands and mappings to work with the contents of the quickfix window.
Append, sort, merge
If you've executed a grep/ack command and you have a bunch of stuff in your quickfix window, but want to add another grep to it, this could help:
:Ack ProjectCollaborator
:Qfappend Ack UserCollaborator
This will add the new search results to the end of the quickfix list, instead of replacing it. You could also swap the order by using :Qfprepend:
:Ack ProjectCollaborator
:Qfprepend Ack UserCollaborator
Duplicates should automatically be removed (two hits on the same line in the same file). However, the order is going to be the exact order of the first list + second list. To sort the current quickfix list alphabetically on the filename, use :Qfsort:
:Ack ProjectCollaborator
:Qfappend Ack UserCollaborator
:Qfsort
You can also provide :Qfsort with a command and it'll execute that first, allowing you to do:
:Ack ProjectCollaborator
:Qfsort Qfappend Ack UserCollaborator
The same commands are available without the "Qf" prefix within the actual buffer:
:Append
:Prepend
:Sort
:Merge
Filtering entries
The plugin defines commands to remove lines by pattern:
:RemoveText <some-pattern> -> matches the text entries
:RemoveFile <some-pattern> -> matches the file entries
You can also do the opposite and only keep files/text entries matching a particular pattern:
:KeepText <some-pattern>
:KeepFile <some-pattern>
As an example, if you're searching for some code that gives you results in both javascript and handlebars files, you can remove all files with the .hbs extension from the quickfix list like so:
:RemoveFile \.hbs$
Alternatively, you can keep only javascript files with:
:KeepFile \.js$
This way, you can filter out test files, or narrow down the pattern you searched for within the found matches.
If you'd like to just remove, or keep, a range of lines, you can use these two commands:
<start>,<end>RemoveLines
<start>,<end>KeepLines
The range is a perfectly normal range, so visual mode works with both of these. You can mark a visual-mode selection and run :RemoveLines to remove the selection from the quickfix window.
You can disable these commands by setting g:qftools_no_buffer_commands to 1.
You can also use the d mapping similar to the built-in one:
ddremoves a single line- visual-mode d removes the selected lines
d{motion}deletes the lines affected by the motion (for instance,dGwould delete all lines till the end of the buffer)
You can "undo" and "redo" deletions by using u and <c-r>. These mappings are not as powerful as Vim's built-in undo mechanism, but they should work mostly as expected. Currently, all they do is provide a thin wrapper to :colder and :cnewer.
You can disable these mappings by setting g:qftools_no_buffer_mappings to 1.
Saving and loading
If you'd like to persist a quickfix list to a file, you can use :Qfsave and :Qfload, which saves the list in a file with one JSON entry per line:
:Ack ProjectCollaborator
:Qfsave collaborator_results.jsonl
To load the results later, provide the same filename:
:Qfload collaborator_results.jsonl
Inside the quickfix buffer, these commands are available as :Save and :Load.
You can let the plugin automatically save and load your quickfix lists in a similar way to how persistent-undo works. You need to set g:qftools_autosave to 1, and you should set g:qftools_autosave_dirs to a list of directories to attempt to save the data in (possibly project-relative). The plugin will not create directories for you.
You can test the autosave/autoload mechanism by calling the functions directly:
:call qftools#AutoSave()
:call qftools#AutoLoad()
By default, only the current list will be saved, but you can save a certain number of historical lists by changing g:qftools_autosave_max_count.
Open mappings
There are buffer-specific mappings defined that help you open files in different ways:
oopens the file the same way as<cr>, but it's closer to the home rowtopens the file in a new tabTopens the file in a new tab, without switching to itiopens the file in a new horizontal splitSopens the file in a new vertical split
They've been taken pretty much as-is from the ack.vim plugin. You can disable them by setting g:qftools_no_buffer_mappings to 1.
Alternatives
- vim-qf includes some of the functionality of this plugin and it's older, so it might be more reliable.
- persist-quickfix.nvim allows saving and loading quickfix windows, though with a different interface. Neovim-only.
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
