Vim - 从快速修复中删除文件

1 vim

假设我的 Quickfix 中有 10 行来自 3 个文件:1.txt、2.txt 和 3.txt。

1.txt - 3 lines
2.txt - 3 lines
3.txt - 4 lines
Run Code Online (Sandbox Code Playgroud)

我想要做的是设置一个绑定,该绑定将从快速修复光标下的文件中删除所有条目。我使用 Cfilter 插件,但它需要更多的输入,所以一开始我必须拉出所需的文件名,然后运行:Cfilter! <filename>,这不是很方便。

关于如何更好地实现这一目标有什么想法吗?

谢谢

rom*_*inl 5

You can use :help c_ctrl-r_ctrl-f to insert the filename under the cursor.

With it, your command:

:Cfilter! foo/bar/baz.txt<CR>
Run Code Online (Sandbox Code Playgroud)

can become:

:Cfilter! <C-r><C-f><CR>
Run Code Online (Sandbox Code Playgroud)

which can be mapped for convenience:

" in after/ftplugin/qf.vim
nnoremap <buffer> <key> :Cfilter! <C-r><C-f><CR>
Run Code Online (Sandbox Code Playgroud)

All you have to do is move the cursor on an entry from the file you don't want and press <key>.