Wikia

Vim Tips Wiki

Changes: Adding Vim to MS-Windows File Explorer Menu

Edit

Back to page

(Change <tt> to <code>, perhaps also minor tweak.)
(Corrected the path used to register Vim on the context menu, existing one was just flat wrong.)
 
(5 intermediate revisions by 2 users not shown)
Line 12: Line 12:
 
}}
 
}}
 
When Vim is correctly installed on a Windows 32-bit system (for example, using the [[Where to download Vim|''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 [[Where to download Vim|''I'm using 64-bit Windows'']]). This tip shows how to repair or manually add the context menu on a 32-bit system.
 
When Vim is correctly installed on a Windows 32-bit system (for example, using the [[Where to download Vim|''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 [[Where to download Vim|''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 [[Building_Vim#Building_Vim_on_Windows|build Vim yourself]], should automatically set this up regardless of whether you use 32-bit or 64-bit Vim.
   
 
{{RegistryWarning}}
 
{{RegistryWarning}}
   
==From tip 1068==
+
==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.
+
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.
   
To fix, run regedit and set the following values to the correct paths:
+
Run regedit and set the following values to the correct paths:
 
<pre>
 
<pre>
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim]
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim]
path=C:\Program Files\vim\vim72\gvim.exe
+
path=C:\Program Files\vim\vim74\gvim.exe
   
 
[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
 
[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
(Default) = C:\Program Files\vim\vim72\gvimext.dll
+
(Default) = C:\Program Files\vim\vim74\gvimext.dll
 
</pre>
 
</pre>
   
==Original tip==
+
These are the registry locations used by the Vim installer and install.exe program.
To add "Edit with Vim" to the Windows File Explorer context menu:
+
  +
==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.
 
*Save this file as edit-with-vim.reg.
 
*Make sure the paths are right for your machine.
 
*Make sure the paths are right for your machine.
Line 34: Line 36:
 
*The double quotes are needed for filenames with spaces.
 
*The double quotes are needed for filenames with spaces.
 
*The '*' means 'for all files'.
 
*The '*' means 'for all files'.
  +
*Use whatever path you installed Vim to for the shell\vim\command value.
   
 
<pre>
 
<pre>
Line 40: Line 43:
 
@="Edit with &Vim"
 
@="Edit with &Vim"
 
[HKEY_CLASSES_ROOT\*\shell\vim\command]
 
[HKEY_CLASSES_ROOT\*\shell\vim\command]
@="c:\\bin32\\gvim.exe \"%1\""
+
@="c:\Program Files (x86)\vim\vim73\gvim.exe" "%1"
 
</pre>
 
</pre>
  +
  +
This registry location is not the same as that used by the installer, it takes advantage of the same Windows features used by [[Windows file associations|file associations]] to set up a global context menu entry for the Vim executable.
   
 
==See also==
 
==See also==
Line 48: Line 53:
   
 
==Comments==
 
==Comments==
Why isn't GvimExt (gvimext.dll) used? When is GvimExt needed?
 
 
----
 
In Windows 7 x64 the 32-bit installer does not successfully add "Edit with Vim" to the right-click context menu. Here's how to do it manually in Windows x64:
 
<pre>
 
Windows Registry Editor Version 5.00
 
[HKEY_CLASSES_ROOT\*\shell\Edit with Vim\command]
 
@="C:\\Program Files (x86)\\Vim\\vim72\\gvim.exe \"%1\""
 
</pre>
 
 
Using regedit to edit the registery, browse to <code>HKEY_CLASSES_ROOT\*\shell</code>, then create a new key ("folder") called "<code>Edit with Vim</code>" (without the quotes), and then create a new key ("folder") under that called "<code>command</code>" (without the quotes). In <code>command</code>, edit the "(Default)" value so it contains (exactly as shown, including the four quotes):
 
<pre>
 
"C:\Program Files (x86)\Vim\vim72\gvim.exe" "%1"
 
</pre>
 
Also the value of (Default) in the key ("folder") called "Edit with Vim" should be changed to "Edit with &Vim" (without quotes; <&> is needed to underline <V> to have a shortcut)
 

Latest revision as of 13:56, May 23, 2014

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)Edit

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\vim74\gvim.exe

[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
(Default) = C:\Program Files\vim\vim74\gvimext.dll

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

Using gvim.exe directly (alternate method)Edit

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.
REGEDIT4
[HKEY_CLASSES_ROOT\*\shell\vim]
@="Edit with &Vim"
[HKEY_CLASSES_ROOT\*\shell\vim\command]
@="c:\Program Files (x86)\vim\vim73\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 alsoEdit

CommentsEdit

Around Wikia's network

Random Wiki