Vim Tips Wiki
Register
Advertisement
Tip 636 Printable Monobook Previous Next

created 2004 · complexity basic · version 6.0


When Vim is correctly installed on a Windows 32-bit system (for example, using the Vim without Cream distribution), you should see an "Edit with Vim" item in the right-click context menu in Windows Explorer. The same can be achieved on a Windows 64-bit system providing a 64-bit distribution is used (see I'm using 64-bit Windows). This tip shows how to repair or manually add the context menu on a 32-bit system.

Note that properly installing Vim, either from a distributed pre-built installer or using install.exe when you build Vim yourself, should automatically set this up regardless of whether you use 32-bit or 64-bit Vim.

WARNING: Editing your Windows registry may cause unintended side effects that render your system inoperable. Although this tip has worked in the past for some people, there is no guarantee that it will work for you. Use with caution, and at your own risk.

Using gvimext.dll (as the installer does)[]

Using gvim under Windows, if you move your Vim folder, you will find that "Edit with Vim" is missing from the context menu when you right click a file in Windows Explorer. This lets you repair the context menu when you install a new Vim, etc.

Run regedit and set the following values to the correct paths:

[HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim]
path=C:\Program Files\Vim\vim80\gvim.exe
  • Save this file as edit-with-vim-dll.reg.
  • Make sure the paths are right for your machine.
  • Double click on it in Explorer to import this file.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}]
@="Vim Shell Extension"

[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
@="C:\\Program Files\\Vim\\vim80\\gvimext.dll"
"ThreadingModel"="Apartment"

For 64-bit Windows, use gvimext64.dll instead.

  • Save this file as edit-with-vim-64bit-dll.reg.
  • Make sure the paths are right for your machine.
  • Double click on it in Explorer to import this file.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}]
@="Vim Shell Extension"

[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
@="C:\\Program Files\\Vim\\vim80\\GvimExt\\gvimext64.dll"
"ThreadingModel"="Apartment"

Note: the vim80 directory should be changed to the installed vim version. (e.g. vim74)

These are the registry locations used by the Vim installer and install.exe program.

Using gvim.exe directly (alternate method)[]

To add "Edit with Vim" to the Windows File Explorer context menu without any dependency on the DLL:

  • Save this file as edit-with-vim.reg.
  • Make sure the paths are right for your machine.
  • Double click on it in Explorer to import this file.
  • The double quotes are needed for filenames with spaces.
  • The '*' means 'for all files'.
  • Use whatever path you installed Vim to for the shell\vim\command value.
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\Shell\Vim]
@="Edit with &Vim"
"Icon"="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\""

[HKEY_CLASSES_ROOT\*\Shell\Vim\command]
@="\"C:\\Program Files\\Vim\\vim80\\gvim.exe\" \"%1\""

This registry location is not the same as that used by the installer, it takes advantage of the same Windows features used by file associations to set up a global context menu entry for the Vim executable.

See also[]

Comments[]

Advertisement