vim - How can I set a particular shortcut key for an item in the Windows 7 Explorer right-click context menu?

29
2014-01
  • Highly Irregular

    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.

  • Answers
  • Mike Clark

    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}]
    

  • Related Question

    Windows: How to remove items from the right click (context) menu?
  • Ashwin

    The right click (context) menu is minimal and clean on a fresh installation of Windows. Install a bunch of applications and soon the context menu is loaded with all kinds of opening options from various applications.

    How do I remove items from the right click (context) menu?

    I find that there are different types of right click menu items:

    • Global items that appear in all context menus.

    • Items that appear only on folders.

    • Items that appear only on files.

    • Items that appear only on special folders (Ex: Right clicking a folder of MP3s shows up a context menu with items like Play with Windows Media Player.)

    • Items that appear only on certain file types (Ex: Right clicking a MP3 file shows up a context menu with items from Windows Media Player/Foobar2000/VLC/your-favorite-media-player begging to open this file.)

    I want to be able to delete all these kinds items from the right click (context) menu.


  • Related Answers
  • 8088

    I've written a lengthy explanation of how to clean up a messy context menu, using either the registry editor or some freeware NirSoft tools.

    How to Clean Up Your Messy Windows Context Menu

    alt text

  • Paolo Bergantino

    From here:

    1. Click Start
    2. Click Run
    3. Type in regedit and click ENTER
    4. Browse to the following: HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers
    5. You simply delete or export then delete the keys you do not want

    There are several "kinds" of menu handlers, however, so you could browse to any of the following and perhaps find stuff you want to get rid of:

    HKEY_CLASSES_ROOT\*\OpenWithList
    HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers
    HKEY_CLASSES_ROOT\Directory\Background
    HKEY_CLASSES_ROOT\Directory\shell
    HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers
    HKEY_CLASSES_ROOT\Drive\shell
    HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers
    HKEY_CLASSES_ROOT\Folder\shell
    HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers
    
  • user10775

    If you're running Windows XP, Microsoft has a free utility called Microsoft PowerToys for Windows XP. The specific "PowerToy" that has the remove menu items options is called "TweakUI".

    How to edit menu options with TweakUI:

    1. Download, install and open TweakUI.
    2. Click on the the "Templates" option on the left hand side.
    3. Check/uncheck the items you want.
    4. Bonus: Add other custom items.

    Link

  • therube

    Oops. Didn't realize How-To-Geek had it covered. (Not used to the aero look & didn't even realize it was ShellExView.)

    Direct link to nirsoft's page for reference, http://www.nirsoft.net/utils/shexview.html.

    "ShellExView - Shell Extensions Manager" http://www.nirsoft.net/utils/shexview.html Shell Extensions are in-process COM objects which extends the abilities of Windows operating system. Most shell extensions are automatically installed by the operating system, but there are also many other applications that install additional shell extension components. For example: If you install WinZip on your computer, you'll see a special WinZip menu when you right-click on a Zip file. This menu is created by adding a shell extension to the system. The ShellExView utility displays the details of shell extensions installed on your computer, and allows you to easily disable and enable each shell extension. ShellExView can be used for solving context-menu problems in Explorer environment. For more information, read the following article: Right-click is slow or weird behavior caused by context menu handlers.
  • Diogo

    To do this, I use Glary Utls:

    Glary Utilities is the #1 free, powerful and all-in-one utility in the world market! It offers numerous powerful and easy-to-use system tools and utilities to fix, speed up, maintain and protect your PC.

  • galacticninja

    To add to the other answers, here are other software that can also edit the Context Menu:

    • Default Programs Editor - Its UI makes it easy to disable context menu of a specific file type.

    • MenuMaid - Its UI makes it easy to disable all context menu from a specific program.