Monday, February 7, 2011

Multiple tabs in windows vista and gvim

Hi all,

I am trying to get the "Edit with Vim" my Right click context menu to work, so that each new file I open opens in a new tab in a single instance of vim.

Currently, using Regedit I have set

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

The registry key is of type 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.

Vim version 7.2 (although I saw the same behaviour on 7.1) Windows vista home premium

Thanks for any help.

David.

  • 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

    Thomas Kammeyer : This old vim.org tips have moved. kobusb: could you edit your answer to mention this instead? http://vim.wikia.com/wiki/Add_open-in-tabs_context_menu_for_Windows
    Thomas Kammeyer : You might as well also add the search: http://vim.wikia.com/wiki/Special:Search?searchx=Search&search=context+menu&go=Try+exact because the whole open-in-tabs-with-context-menu set of tips has gotten messy over at the vim tips wiki.
    From kobusb
  • 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.

  • 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?

    cheers,

    david.

  • You were on the right track:

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

    was sufficient ... it works!!

    From Krishna

0 comments:

Post a Comment