开发者

Vim as the default editor

I'm on Windows XP and I just installed GVim 7.3. How do I make the default editor? How c开发者_运维百科an I make it run using the command prompt e.g.

c:\Windows>gvim boot.ini

open this file in gvim.

Thanks a lot


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.


Right click the any file you want to open -> select Open or Open With ->check always open with the following editor.


  1. After installing vim the "Edit with vim..." menu item appears in the context menu (RMB click on any file to check). Thus you can edit any file (not only text file) with just selecting this menu item

  2. Add gvim to the PATH variable and you can run it right as you want:

    c:\Windows>gvim boot.ini
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜