Windows 和 gvim 中的多个选项卡

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/67518/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:11:45  来源:igfitidea点击:

Multiple tabs in Windows and gvim

windowsvimtabs

提问by David Turner

I am trying to get the Edit with Vimcontext menu to open files in a new tab of the previously opened Gvim instance (if any).

我试图让Edit with Vim上下文菜单在先前打开的 Gvim 实例(如果有)的新选项卡中打开文件。

Currently, using RegeditI have modified this key:

目前,使用Regedit我修改了这个键:

\HKEY-LOCAL-MACHINE\SOFTWARE\Vim\Gvim\path = "C:\Programs\Vim\vim72\gvim.exe" -p --remote-tab-silent "%*"

The registry key type is REG_SZ.

注册表项类型是REG_SZ.

This almost works... Currently it opens the file in a new tab, but it also opens another tab (which is the active tab) the tab is labeled \W\S\--literaland the file seems to be trying to open the following file.

这几乎有效......目前它在一个新选项卡中打开文件,但它也会打开另一个选项卡(这是活动选项卡)该选项卡被标记\W\S\--literal并且该文件似乎正在尝试打开以下文件。

C:\Windows\System32\--literal

I think the problem is around the "%*"- I tried changing that to "%1"but if i do that I get an extra tab called %1.

我认为问题出在"%*"- 我尝试将其更改为,"%1"但如果我这样做,我会得到一个名为%1.

Affected version

受影响的版本

  • Vim version 7.2 (same behaviour on 7.1)
  • Windows vista home premium
  • Vim 7.2 版(7.1 上的行为相同)
  • Windows Vista 家庭高级版

Thanks for any help.

谢谢你的帮助。

David.

大卫。

采纳答案by kobusb

Try setting it to: "C:\Programs\Vim \vim72\gvim.exe" -p --remote-tab-silent "%1" "%*"

尝试将其设置为: "C:\Programs\Vim \vim72\gvim.exe" -p --remote-tab-silent "%1" "%*"

See: http://www.vim.org/tips/tip.php?tip_id=1314

见:http: //www.vim.org/tips/tip.php?tip_id=1314

EDIT: As pointed out by Thomas, vim.org tips moved to: http://vim.wikia.com/

编辑:正如 Thomas 所指出的,vim.org 提示移至:http://vim.wikia.com/

See: http://vim.wikia.com/wiki/Add_open-in-tabs_context_menu_for_Windows

请参阅:http: //vim.wikia.com/wiki/Add_open-in-tabs_context_menu_for_Windows

回答by David Turner

I found the answer... The link to cream gave me some additional areas to search around.

我找到了答案... cream 的链接给了我一些额外的搜索区域。

from http://genotrance.wordpress.com/2008/02/04/my-vim-customization/there is a vim.reg registry file that contains the following

http://genotrance.wordpress.com/2008/02/04/my-vim-customization/有一个 vim.reg 注册表文件,其中包含以下内容

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\Edit with Vim]
@=""

[HKEY_CLASSES_ROOT\*\shell\Edit with Vim\command]
@="\"C:\Programs\vim\vim72\gvim.exe\" -p --remote-tab-silent \"%1\" \"%*\""

[HKEY_CLASSES_ROOT\Applications\gvim.exe\shell\open\command]
@="\"C:\Programs\vim\vim72\gvim.exe\" -p --remote-tab-silent \"%1\" \"%*\""

this gives me the behaviour I want.

这给了我我想要的行为。

So I guess my original plan of editing the HKEY_LOCAL_MACHINE was just wrong.

所以我想我原来编辑 HKEY_LOCAL_MACHINE 的计划是错误的。

Would also be nice to know what exactly what the "%1" and "%*" mean/ refer to.

也很高兴知道“%1”和“%*”究竟是什么意思/指的是什么。

Now... should I edit my original question, to show that I was starting off in the wrong registry area?

现在...我应该编辑我原来的问题,以表明我是在错误的注册表区域开始的吗?

回答by Krishna

You were on the right track:

你在正确的轨道上:

HKEY-LOCAL-MACHINE\SOFTWARE\Vim\Gvim\path = "C:\Programs\Vim \vim72\gvim.exe" -p

was sufficient ... it works!!

足够了......它有效!!

回答by Lord Future

I would recommend trying Cream.

我会推荐尝试Cream

Cream is a set of scripts and add-ons that sit on top of gVim. Cream doesn't change the appearance of gVim, but it does change the way it behaves.

Cream 是一组位于 gVim 之上的脚本和附加组件。Cream 不会改变 gVim 的外观,但它确实会改变它的行为方式。

One of those behaviours is a tabbed document interface. Other behaviours are listed here. The downloads page is here.

其中一种行为是选项卡式文档界面。此处列出其他行为。下载页面在这里

回答by Lord Future

There is an even cleaner fix using your _vimrc. Add the following line:
autocmd BufReadPost * tab ball
from http://www.vim.org/scripts/script.php?script_id=1720

使用您的_vimrc. 添加以下行:
autocmd BufReadPost * tab ball
来自http://www.vim.org/scripts/script.php?script_id=1720