0

我在我的 vim 中打开了一些窗口(这些窗口是使用 split :split/:vsplit命令创建的)。我还有一个填充了文件列表的快速修复列表(这是我使用command然后加载:cf:copen的 grep 命令的结果)。

当我将光标放在快速修复中列出的文件名之一上时,我可以按Enter 键打开它。它将作为新缓冲区打开其内容并将其显示在可用窗口之一中。但是,我希望 vi 将此文件加载到特定窗口中。现在,它正在使用一个我想保持不变的窗口。怎么做?

4

2 回答 2

0

来自:help quickfix-window

You can use ":.cc" to jump to the error under the cursor.
Hitting the <Enter> key or double-clicking the mouse on a line has the same
effect.  The file containing the error is opened in the window above the
quickfix window.  If there already is a window for that file, it is used
instead.  If the buffer in the used window has changed, and the error is in
another file, jumping to the error will fail.  You will first have to make
sure the window contains a buffer which can be abandoned.
                    *CTRL-W_<Enter>* *CTRL-W_<CR>*
You can use CTRL-W <Enter> to open a new window and jump to the error there.

的行为<Enter>可以进一步改变,:help 'switchbuf'但没有明确和确定的方式告诉 Vim 使用特定窗口。

于 2021-04-15T19:57:45.913 回答
0

其中:1windo e Ctrl-RCtrl-FEnter“1”是目标窗口编号。

如果打字看起来太长,那么~/.vim/after/ftplugin/qf.vim像往常一样定义一些缓冲区本地映射。

于 2021-04-15T20:22:22.003 回答