如何使vim中的netrw像visualstudio中的解决方案浏览器一样工作



好吧,我会在这里说得更清楚。。假设我有一个垂直拆分窗口中的目录列表,以及我正在编辑的文件。。

我可以使用Ctrl+w从一个拆分转到另一个拆分并使用netrw插件以四种方式打开文件列表中的文件。。使用返回键,v,o,t.

使用return键,它将在当前(netrw)拆分窗口中打开。。使用v,它将创建一个新的垂直拆分。。(与o(水平拆分)、t(新选项卡)相同)

但我希望文件在另一个已经存在的分割中打开,在那里我进行所有编辑。。而不是打开一个新的拆分。。我希望我的问题很清楚。。比如说,通过键入命令,高亮显示的文件将在编辑拆分中打开,而不是在netrw拆分中打开。。对此一定有一些简单的解决办法。。或者有人能告诉我使用netrw的最佳方法吗。。我会努力适应的。。

答案在文档中::h netrw。和往常一样。

您正在寻找P:

To edit a file or directory in the previously used (last accessed) window (see
:he CTRL-W_p), press a "P".  If there's only one window, then the one window
will be horizontally split (above/below splitting is controlled by
g:netrw_alto, and its initial size is controlled by g:netrw_winsize).
If there's more than one window, the previous window will be re-used on
the selected file/directory.  If the previous window's associated buffer
has been modified, and there's only one window with that buffer, then
the user will be asked if s/he wishes to save the buffer first (yes,
no, or cancel).

另一种方法:使用:让g:netrw_chgwin=2(或您喜欢的任何窗口号)。随后在netrw中选择的文件将使用该窗口进行编辑。

相关内容

最新更新