Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
878 views
in Technique[技术] by (71.8m points)

windows - 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 can I make it run using the command prompt e.g.

c:Windows>gvim boot.ini

open this file in gvim.

Thanks a lot

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...