Vim Tips Wiki
No edit summary
 
(Corrected the path used to register Vim on the context menu, existing one was just flat wrong.)
(17 intermediate revisions by 8 users not shown)
Line 1: Line 1:
  +
{{TipImported
{{review}}
 
{{Tip
 
 
|id=636
 
|id=636
  +
|previous=635
|title=Adding Vim to MS-Windows File Explorer Menu
 
  +
|next=637
|created=January 14, 2004 17:53
+
|created=2004
 
|complexity=basic
 
|complexity=basic
|author=http://www.cs.albany.edu/~mosh
+
|author=
|version=5.7
+
|version=6.0
 
|rating=43/15
 
|rating=43/15
  +
|category1=Windows
|text=
 
  +
|category2=
What: To Add 'Edit with Vim' to 'Windows File Explorer'
 
 
'right click Menu'
 
 
 
 
1. Save this file as edit-with-vim.reg,
 
 
2. Make sure the paths are right for your machine
 
 
3. Change each fowardslash to backslash
 
 
with the vim command :%s,/,\\,g
 
 
4. Click on it in explorer or import this file in regedit.exe
 
 
voila, your explorer right-click menu will have extra action items,
 
 
it's better than the send-to.
 
 
5. The double quotes are needed for filenames with spaces.
 
 
6. The '*' means 'for all files'.
 
 
 
 
REGEDIT4
 
 
[HKEY_CLASSES_ROOT/*/shell]
 
 
[HKEY_CLASSES_ROOT/*/shell/vim]
 
 
@="Edit with &vim"
 
 
[HKEY_CLASSES_ROOT/*/shell/vim/command]
 
 
@="c://bin32//gvim.exe /"%1/""
 
 
[HKEY_CLASSES_ROOT/*/shell/_emacs]
 
 
@="Edit with &Emacs"
 
 
[HKEY_CLASSES_ROOT/*/shell/_emacs/command]
 
 
@="c://emacs//bin//runemacs.exe /"%1/""
 
 
 
 
 
 
}}
 
}}
  +
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.
== Comments ==
 
Why don't you use GvimExt?
 
   
  +
{{RegistryWarning}}
'''Anonymous'''
 
, January 15, 2004 18:44
 
----
 
i thought this facility is already available if you install gvim... am i wrong?
 
   
  +
==Using gvimext.dll (as the installer does)==
viswanathb--AT--yahoo.com
 
  +
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.
, January 16, 2004 2:08
 
----
 
This will allow window's explorer to launch
 
vim on directories also (the paths have double backslashes).
 
   
  +
Run regedit and set the following values to the correct paths:
  +
<pre>
  +
[HKEY_LOCAL_MACHINE\SOFTWARE\Vim\Gvim]
  +
path=C:\Program Files\vim\vim74\gvim.exe
   
[HKEY_CLASSES_ROOT\Directory\shell\vim_dired]
+
[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32]
  +
(Default) = C:\Program Files\vim\vim74\gvimext.dll
--AT--="gvim dired"
 
  +
</pre>
   
  +
These are the registry locations used by the Vim installer and install.exe program.
[HKEY_CLASSES_ROOT\Directory\shell\vim_dired\Command]
 
--AT--="c:\\bin32\\gvim.exe \"%1\""
 
   
  +
==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.
   
  +
<pre>
 
 
REGEDIT4
 
[HKEY_CLASSES_ROOT\*\shell\vim]
 
@="Edit with &Vim"
 
[HKEY_CLASSES_ROOT\*\shell\vim\command]
  +
@="c:\Program Files (x86)\vim\vim73\gvim.exe" "%1"
  +
</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.
http://www.cs.albany.edu/~mosh
 
, January 16, 2004 20:12
 
----
 
What I'd kill for would be the ability to always have GvimExt's "Edit with Vim" menu item as the *first* item on the menu (like it was with Vim 5.x) and *also* have 2 additional context menu options:
 
   
  +
==See also==
- Vertically split into existing Vim [foo]
 
  +
*[[VimTip861|Right click in Windows Explorer to open gvim in explorer mode]]
- Horizontally split into existing Vim [foo]
 
  +
*[[Windows file associations]]
   
 
==Comments==
'''Anonymous'''
 
, January 17, 2004 9:52
 
----
 
<!-- parsed by vimtips.py in 0.710407 seconds-->
 

Revision as of 13:56, 23 May 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)

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)

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 also

Comments