Vim Tips Wiki
(Change to TipImported template + severe manual clean)
(Move categories to tip template)
Line 10: Line 10:
 
|version=5.7
 
|version=5.7
 
|rating=53/23
 
|rating=53/23
  +
|category1=Windows
  +
|category2=
 
}}
 
}}
 
I find myself installing the following registry modification for all my PCs now (even other people's PCs). It applies to Microsoft Windows machines only. The following is also for Windows 9x. NT or XP or 2000 may require modifications (which I don't care to understand!).
 
I find myself installing the following registry modification for all my PCs now (even other people's PCs). It applies to Microsoft Windows machines only. The following is also for Windows 9x. NT or XP or 2000 may require modifications (which I don't care to understand!).
Line 78: Line 80:
   
 
----
 
----
[[Category:Windows]]
 

Revision as of 01:01, 25 April 2008

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 279 Printable Monobook Previous Next

created July 9, 2002 · complexity intermediate · author jcline · version 5.7


I find myself installing the following registry modification for all my PCs now (even other people's PCs). It applies to Microsoft Windows machines only. The following is also for Windows 9x. NT or XP or 2000 may require modifications (which I don't care to understand!).

The problem: You double-click on a file that doesn't have a 'registered type' and that pesky "What program should I use?" dialog pops up. Even worse, depending on the installation, the GVim icon may not be listed, and one has to browse to the executable. and then the type becomes forever bonded to being editted with GVim (if that box is checked). The standard Vim 6.1 installation does include a "right click to edit" menu item for all files, but a double-click is so much faster!

The solution: What if unregistered types would just automatically open up in GVim? Well, they can. with a little registry trickery.

How to Install it

Step 1. Create a text file called "vimalways.reg" and paste the below text into it.

REGEDIT4
[HKEY_CLASSES_ROOT\Unknown\shell]
@="vim"
[HKEY_CLASSES_ROOT\Unknown\shell\vim]
[HKEY_CLASSES_ROOT\Unknown\shell\vim\command]
@="\"C:\\Vim\\vim61\\gvim.exe\" \"%1\""

Step 2. Important NOTE: You will have to edit the pathname to correspond to the pathname of your GVim.exe. The text below works fine for a GVim 6.1 default installation.

Step 3: Save the file.

Step 4: Right-click on the file and select "install". Then you are done!

Note 1. This can't be de-installed automatically, and if you want to remove it, you'll have to edit the registry by hand (annoying, but easy).

Note 2. Keep this file around, so when you upgrade your GVim, all you have to do is modify the pathname (to say, for example, vim62) and then install it again.

Compatibility note

  • MS Windows 95 - works OK
  • MS Windows 98 - works OK
  • MS Windows NT - not sure; if anyone can confirm this please add a note.
  • MS Windows 2000 - works OK
  • MS Windows XP - should work.

Comments

What I do on any machine I'm working on, and should work in any of the Windows OSs, is add a shortcut to Gvim in my SendTo folder. This can be done by:

  • Right-click on the START button.
  • Click Explore All Users
  • Find the folder with your username and open it.
  • Find the Send To folder, and copy a shortcut to Gvim in there.

Now, if I right-click on any file, I can choose to send it to GVim by using the Gvim short-cut on the Send-to list.


The above instructions maybe impossible to perform if you have insufficient privileges. In that case, it appears that HKEY_CLASSES_ROOT can be replaced by

HKEY_CURRENT_USER\Software\Classes

(This works for me on win2k)


I had a MERGE option when right clicking on the .reg file. I also couldn't get it to import until I added the top line below. Thought I'd share the modification I had to make. Thanks for the tip.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Unknown\shell]
@="vim"

[HKEY_CURRENT_USER\Unknown\shell\vim]

[HKEY_CURRENT_USER\Unknown\shell\vim\command]
@="\"C:\\Program Files\\Vim\\vim70\\gvim.exe\" \"%1\""