在 gvim 的新选项卡中打开文件
几天前我开始在 Windows 上使用 vim/gvim。到目前为止我一直使用 notepad++,但想开始完全使用 gvim。
我发现的一件事是,在 gvim 中打开文件(通过双击文件)总是会打开一个新的 gvim 实例,即使另一个 gvim 实例已经在运行。我可以在 gvim 中打开任何设置,以便在已运行的 gvim 实例的新选项卡中打开文件吗?
I started using vim/gvim for windows few days ago. I use notepad++ until now but would like to start using gvim completly.
One thing i find is, on opening a file in gvim(by double clicking the file) always opens a new instance of gvim even if another gvim instance is already running. Is there any setting that i can turn on in gvim for it to open up the file in a new tab of an already running instance of gvim?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然你可以运行:
当你运行时:
这将在新选项卡中的同一窗口中打开...
此外,如果你从本机 Windows 安装程序安装了 gvim,你应该有一个 shell 扩展,它允许你“在现有的窗口中打开” vim”来自 Windows 资源管理器。这实际上将默认在新缓冲区而不是新选项卡中打开。可以通过执行“:bn”(下一个缓冲区)或“:bp”(上一个缓冲区)在缓冲区之间导航。就我个人而言,我更喜欢它们而不是选项卡。
Sure you can just run:
When you run:
This will open in the same window in a new tab...
Additionally, if you installed gvim from the native windows installer, you should have a shell extension which allows you to "open in existing vim" from windows explorer. This will actually default to opening in a new buffer rather than a new tab. A buffer buffers can be navigated between by doing ":bn" (buffer next) or ":bp" (buffer previous). Personally I prefer them to tabs.
既然你提到了notepad++,我假设你在Windows上使用vim。然后尝试一下,看看它是否适合您。
http://vim.wikia.com/wiki/Launch_files_in_new_tabs_under_Windows
since you mentioned notepad++, I assume that you are using vim on windows. then try this out, see if it works for you.
http://vim.wikia.com/wiki/Launch_files_in_new_tabs_under_Windows
我看到接受的答案提供了一种通过命令行实现目标的方法。如果您想双击文件以在现有 gvim/macvim 窗口的新选项卡中打开它。尝试在 gvim/macvim 的首选项面板中选择“从应用程序打开文件 -> 在当前窗口中 -> 每个文件都有一个选项卡”。
I see the accepted answer gives a way to achieve the target via command line. In case you want to double click a file to open it in a new tab of the existing gvim/macvim window. Try to select "open files from applications -> in the current window -> with a tab for each file" in the preference panel of gvim/macvim.