Vim as the default editor

vim, windows

Solution

Add Gvim to your PATH variable

To be able to call Gvim from the command line, you have to add the installation directory of Vim to your `PATH` variable. To do that, right click on My Computer on the desktop (or in Explorer) → Properties → Advanced Tab → Click on Button Environment Variables.

In the Dialog, go to the User Variables field and search if there is already a `PATH` variable. If there is a `PATH` Variable, select it, click Edit and change it as follows:

%PATH%;C:/Program Files/Vim/Vim73

(or whatever the installation directory of Gvim is).

If there is no `PATH` variable set, create a new one with the content written above.

Confirm everything with OK, then open a new command window (important!), navigate to the desired directory and type

gvim somefile.txt

This should bring up your favourite editor.

Set Gvim as default editor for a certain file type

Adding Gvim to your `PATH` doesn't make Gvim the default editor for a certain file type. This can be achieved the following way:

- In Explorer, right click on any file and select Open With → Choose Program

- in the upcoming window, select Vi improved - A Text Editor or browse for gvim.exe if the entry is not already there

- select the Always use the selected program ... checkbox and click OK

- from now on, every time you double-click the file, it will be opened with Gvim

The easiest way

If you install Gvim, be sure to check the Add to context menu option. If you did that, you can right click on any file in the Windows Explorer and select Edit with Vim.

Problem

I'm on Windows XP and I just installed GVim 7.3. How do I make the default editor? How can I make it run using the command prompt e.g. ``` c:\Windows>gvim boot.ini ``` open this file in gvim. Thanks a lot

Original source