Vim 作为默认编辑器 [英] Vim as the default editor
问题描述
我使用的是 Windows XP,我刚刚安装了 GVim 7.3.如何制作默认编辑器?如何使用命令提示符运行它例如
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
在 gvim 中打开这个文件.
open this file in gvim.
非常感谢
推荐答案
将 Gvim 添加到您的 PATH 变量
为了能够从命令行调用 Gvim,您必须将 Vim 的安装目录添加到您的 PATH
变量中.为此,请右键单击桌面(或资源管理器)上的我的电脑 →属性→高级 Tab →点击按钮环境变量.
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.
在对话框中,转到用户变量字段并搜索是否已经存在 PATH
变量.如果有PATH
变量,选中它,点击编辑,修改如下:
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
(或任何 Gvim 的安装目录).
(or whatever the installation directory of Gvim is).
如果没有设置PATH
变量,就用上面写的内容新建一个.
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.
将 Gvim 添加到您的 PATH
不会使 Gvim 成为特定文件类型的默认编辑器.这可以通过以下方式实现:
Adding Gvim to your PATH
doesn't make Gvim the default editor for a certain file type. This can be achieved the following way:
- 在资源管理器中,右键单击任何文件并选择打开方式 →选择程序
- 在即将出现的窗口中,选择 Vi 改进 - 文本编辑器或浏览 gvim.exe(如果该条目不存在)
- 选中始终使用所选程序...复选框,然后单击确定
- 从今以后,每次双击文件,都会用Gvim打开
- 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
如果您安装 Gvim,请务必选中添加到上下文菜单选项.如果这样做,您可以在 Windows 资源管理器中右键单击任何文件,然后选择使用 Vim 编辑.
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.
这篇关于Vim 作为默认编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!