如何让 Vim 的文件浏览器在新缓冲区中打开文件?
有时我通过将 Vim 指向一个目录来启动它,但我还不确定需要更改哪个文件,所以我最终会浏览几个文件。
有没有办法让文件浏览器将选定的文件打开到新的缓冲区中,以便文件浏览器仍然可用,而不必使用 :e path/to/directory 重新打开它?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定您是否可以在新的缓冲区中打开它,但是您可以使用 o 或 v 进行水平或垂直拆分,在新的拆分中打开它分别。
您还可以使用运行
:pedit
的 p 预览文件,其中
是光标下的文件。这将打开一个新的分割窗口,但不会更改光标焦点或位置。您可以使用:pclose
或简单地:pc
关闭此窗口。请参阅
:help netrw-browse-maps
了解更多信息。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.严格来说,这并不是您所要求的,但我认为它是等效的:
如果您从文件浏览器打开文件,则可以使用 CTRL-^ (和/或 CTRL-6 ?) 返回浏览器。这会导致文件在一个缓冲区中打开,文件浏览器在您开始的目录中打开。
希望它有帮助...
This is not strictly speaking what you are asking for, but I think it's equivalent:
If you open a file from the file browser you can use CTRL-^ (and/or CTRL-6 ?) to return to the browser. This results in the file open in one buffer and the file browser open at the directory you started in.
Hope it helps...