【问题标题】:how to make netrw in vim work like solution explorer in visual studio如何使 vim 中的 netrw 像 Visual Studio 中的解决方案资源管理器一样工作
【发布时间】:2014-04-19 03:58:24
【问题描述】:

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

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

使用返回键,它在当前(netrw)拆分窗口中打开.. 使用 v,它会创建一个新的垂直拆分..(与 o(horizo​​ntal split), t(new tab) 相同)

但我希望在已经存在的另一个拆分中打开文件,在那里我进行所有编辑..而不是打开新拆分..我希望我的问题很清楚..说通过输入命令,突出显示的文件将在编辑拆分而不是 netrw 拆分中打开。 必须有一些简单的解决方案..或者有人可以告诉我使用netrw的最佳方法..我会尝试适应..

【问题讨论】:

  • 也许nerdTree 是您想要的,尽管它有缺点。
  • 我对 netrw 很满意.. 但似乎必须有一些组合键才能实现这一点.. 我错过了一些东西.. 如果没有解决方案,我会习惯这个..或者只是安装 nerdtree 插件.. 你确定 nerdtree 解决了这个..
  • 我不确定,因为我不是普通的 Visual Studio 用户,但是当我打开文件时,nerdtree 似乎使用了最后一个非 nerdtree 拆分(也有 i/o/t 和其他)
  • 忘记visual studio ..我在描述中解释了我想要的..当我在树中的一个文件上单击输入时会发生什么..它就在那里打开..而不是我希望它打开在已经存在的拆分窗口中,树拆分完好无损..

标签: vim netrw


【解决方案1】:

答案在文档中::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).

【讨论】:

  • 我确实搜索过它..但没有找到它,我现在找到了我正在尝试这样做一段时间..谢谢..
【解决方案2】:

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

【讨论】:

    猜你喜欢
    • 2015-03-03
    • 2012-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-10-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多