如何使Vim的文件浏览器在新缓冲区中打开文件? [英] How to make Vim's file browser open a file in a new buffer?

查看:168
本文介绍了如何使Vim的文件浏览器在新缓冲区中打开文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时候,我通过将Vim指向一个目录来启动它,但是我还不确定我需要更改哪个文件,所以最终我要浏览几个文件.

有没有一种方法可以使文件浏览器将选定的文件打开到新的缓冲区中,从而使文件浏览器仍然可用,而不必使用:e path/to/directory重新打开它?

解决方案

我不确定是否可以在新的缓冲区中打开它,但是可以使用 o

在新的拆分中打开它分别用于水平分割或垂直分割的kbd>或 v .

您还可以使用运行:pedit <fname> p 预览文件,其中<fname>是光标所在的文件.这将打开一个新的拆分窗口,但不会更改光标的焦点或位置.您可以使用:pclose或仅使用:pc关闭此窗口.

有关更多信息,请参见:help netrw-browse-maps.

Sometimes I start Vim by pointing it at a directory, but I'm not certain yet which file I'll need to change, so I end up looking through several files.

Is there a way to make the file browser open a selected file into a new buffer so that the file browser is still available without having to reopen it with :e path/to/directory ?

解决方案

I'm not sure if you can have it open in a new buffer, but you can have it open in a new split using o or v for a horizontal or vertical split respectively.

You could also preview the file using p which runs :pedit <fname> where <fname> is the file under the cursor. This opens a new split window but doesn't change the cursor focus or position. You can close this window with :pclose or simply :pc.

See :help netrw-browse-maps for more information.

这篇关于如何使Vim的文件浏览器在新缓冲区中打开文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆