2

For me, this issue is specific to opening files through the context menu with gVIm, but it probably applies to more general situations too.

In particular, I want to get gVim to open a file with a single key press from the Windows 7 context menu.

In Windows XP, I could just right click, and type v, and my file (of any extension) would open for editing in gVim. In Windows 7, there seems to be another item using the v shortcut ("Restore previous versions"), so now when I type v the "Edit with Vim" option is highlighted but doesn't instantly run (hitting v subsequently toggles between the 2 items).

There seems to be no context item using the shortcut g, so perhaps I can change it to that. However, I can't find how to do that. Can anyone explain?

Other questions on SU (such as this, and this) focus on how to add extra items to the context menu, but don't seem to cover how to specify a particular shortcut key. They are very close to what I'm trying to do, but not the same, so this is not a duplicate question of those.

1

2 Answers 2

1

I use vim constantly under Windows, and I really miss the ability to use right-click + v to instantly open a file (or alt+f,v if going mouse-free in Explorer). I have also never once found a use for the "Restore previous versions" feature which has hijacked 'v'!

So I found an article that explains how to remove the "Restore previous versions" menu item via registry edits. I never use this menu item anyway, and I don't miss it. Besides, they provide a registry file to restore the menu item, should you ever need it.

http://www.vistax64.com/tutorials/170079-restore-previous-versions-restore-remove-context-menu.html

I'll capture the reg files here for posterity.

Remove:

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[-HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[-HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[-HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

Add:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\AllFilesystemObjects\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]

[HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}]
0

A shortcut key for a context menu item can be set by adding a & symbol before the character you want to use.

E.g.: Edit &file with Vim would allow you to execute the command by pressing Shift+F10,f (or Alt+f,f on Windows 7).

Screenshot of registry entry for shortcut key (sorry, I'm not allowed to embedd the picture directly yet)

As an example, I've created a GitHub Gist for adding a context menu entry, which opens a selected file within the Vim editor included in Git Bash for Windows.

See here: https://gist.github.com/dwettstein/e5349a12852a7aadfda419e76124919c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .