Question

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

Currently, using Regedit I have modified this key:

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

The registry key type is 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\--literal and the file seems to be trying to open the following file.

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.

Affected version

  • Vim version 7.2 (same behaviour on 7.1)
  • Windows vista home premium

Thanks for any help.

David.

Was it helpful?

Solution

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

See: 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/

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

OTHER TIPS

You were on the right track:

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

was sufficient ... it works!!

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

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

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.

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

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

I would recommend trying 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.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top