Windows 上的 Vim 设置文件 [英] Vim settings file on Windows
问题描述
我不敢相信我正在为这样一个简单的事情输入一个问题,但我们来了.我终生无法弄清楚 Windows 上 vim 的设置文件的确切名称是什么(.vimrc
在 Windows 上不起作用).如果我的名字是正确的(阅读下一段),那么我不知道为什么它没有从中获取设置.
I can't believe I am typing a question for a simple thing like this but here we are. I can't for the life of me figure out what the exact name for the settings file is for vim on Windows (.vimrc
does not work on Windows). And if I have names right (read the next para) then I don't know why it is not picking up the settings from it.
我尝试在根目录中创建 _vimrc
和 _gvimrc
,我从 vim 安装的示例设置文件中复制了该文件.我在示例命令之上设置了以下命令:
I tried creating _vimrc
and _gvimrc
in the root directory where I copied the file from the example settings file that came installed with vim. I set the following command on top of the example commands:
set nobackup
set nowritebackup
set guifont=Courier_New:h11:cANSI
它不接受这个文件(无论它被命名为_vimrc
还是_gvimrc
,我都试过)作为设置文件,因为下次启动时字体没有改变-up 并且仍然写入备份文件.
It is not accepting this file (whether it is named _vimrc
or _gvimrc
, I tried both) as the settings file as the font has not changed on the next start-up and still writes backup files.
推荐答案
我的 _vimrc
/_gvimrc
存储在 C:/Users/
并且工作正常.
my _vimrc
/_gvimrc
is stored at C:/Users/<ME>/_vimrc
and is working fine.
将个人设置与安装文件分开通常是个好主意.
It's generally a good idea to keep personal settings separate from installation files.
要获取有关配置文件搜索路径的更多信息,请键入 :he vimrc-intro
.
To get more information about the search paths for your configuration files, type :he vimrc-intro
.
小心:文档说
对于 MS-DOS 和 MS-Windows,您可以使用以下其中一种:
$HOME/_vimrc
$VIM/_vimrc
For MS-DOS and MS-Windows you can use one of these:
$HOME/_vimrc
$VIM/_vimrc
虽然这是绝对正确的,但 $VIM
没有扩展到例如C:/Program Files/vim/
(这是 $VIMRUNTIME
保存的)但仅限于 C:/Program Files/vim/
代码>.
While this is absolutely true, it could be a bit surprising that $VIM
does not expand to e.g. C:/Program Files/vim/<your_version>
(this is what $VIMRUNTIME
holds) but only to C:/Program Files/vim/
.
这就是说,C:/Program Files/vim/_vimrc
应该在启动时读取.
This said, C:/Program Files/vim/_vimrc
should be read during startup.
这篇关于Windows 上的 Vim 设置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!