简体   繁体   English

MacVim无法从自定义gvimrc或vimrc文件加载设置

[英]MacVim unable to load settings from custom gvimrc or vimrc files

Ok so I'm setting up MacVim on my new macbook with Yosemite, using a homebrew installation. 好的,所以我要使用自制软件在Yosemite的新Macbook上设置MacVim。

To start off with I have no ~/.vimrc or ~/.gvimrc files setup at all. 首先,我根本没有〜/ .vimrc或〜/ .gvimrc文件设置。

Also I'm already familiar with links on stackoverflow which have explained that the .gvimrc file settings are usually applied after the .vimrc settings 另外,我已经熟悉stackoverflow上的链接,这些链接解释了.gvimrc文件设置通常在.vimrc设置之后应用

When I execute the following command directly in MacVim my color scheme is applied fine 当我直接在MacVim中执行以下命令时,我的配色方案会很好地应用

:colorscheme twilight

However, when I add the following line to a newly created ~/.gvimrc file the colour scheme does not load when I restart MacVim 但是,当我将以下行添加到新创建的〜/ .gvimrc文件中时,重新启动MacVim时不会加载颜色方案

colorscheme twilight

Keep in mind that I have nothing else apart from this line in my .gvimrc file and I have not setup a .vimrc file. 请记住,除了.gvimrc文件中的这一行之外,我没有别的东西,并且我没有设置.vimrc文件。 If I execute the following command in MacVim 如果我在MacVim中执行以下命令

:scriptnames

I get the following output (not all lines included for clarity): 我得到以下输出(为清晰起见,未包括所有行):

1: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/vimrc
...
14: /usr/local/Cellar/macvim/7.4-73_1/MacVim.app/Contents/Resources/vim/gvimrc
...
20: ~/.gvimrc

You will noticed that MacVim thinks it has loaded the .gvimrc file. 您会注意到MacVim认为它已经加载了.gvimrc文件。 Anyone got any ideas why the color scheme won't load? 有人知道为什么配色方案无法加载吗?

Ok so it looks like I've figured out what the problem is. 好的,看来我已经弄清楚了问题所在。 The gvimrc and vimrc files were setup fine in the end, the problem is to do with what command you're supposed to execute to run MacVim 最后,gvimrc和vimrc文件设置正确,问题在于您应该执行什么命令来运行MacVim

I came across the following link: 我遇到了以下链接:

https://code.google.com/p/macvim/issues/detail?id=138 https://code.google.com/p/macvim/issues/detail?id=138

It was post #6 which made me realise that I was possibly running MacVim in the wrong way. 帖子#6使我意识到我可能以错误的方式运行MacVim。 I'm figuring that initially I probably mistakenly ran the MacVim binary directly which according to that post is the incorrect way to do it. 我在想,最初我可能是错误地直接运行了MacVim二进制文件,根据该帖子,这是不正确的方法。 Of course because I was running MacVim from spotlight it was repeatedly rerunning the incorrect command. 当然,因为我是从聚光灯下运行MacVim的,所以它会反复重新运行不正确的命令。

Anyway, I ran the command Vim -g from the command line instead and it worked fine. 无论如何,我从命令行运行了Vim -g命令,它运行良好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM