问题
I'm having difficulty getting MacVim (7.3-64) to recognize my .vimrc and .gvimrc files since upgrading to OS X 10.7.3. Previous, I've simply symlinked my .vimrc and .gvimrc using these commmands:
$ ln -s ~/.vim/vimrc /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/.vimrc
$ ln -s ~/.vim/gvimrc /usr/local/Cellar/macvim/7.3-57/MacVim.app/Contents/Resources/vim/.gvimrc
However, when I currently symlink my rc files, I can not get MacVim to recognize them. I've installed MacVim via Homebrew. Does anyone have any suggests as to what the problem could be?
回答1:
The ~/.vim/ folder (for colorschemes and scripts) and the ~/.vimrc file (for custom settings and mappings) are guaranteed to work on every UNIX-like systems but neither of these are required for Vim (and MacVim) to work properly.
Start without symlinks or whatever : no
.vimfolder and no.vimrcor.gvimrcin your home folder. Does MacVim work? You are supposed to see a window with some introductory text, do you see that?Quit MacVim and turn to the original
.(g)vimrcfiles you want to use: where are they located? Where did you get them from? What is their content? Do you actually, really need them? Do their names actually start with a dot (do you see them or not in the Finder)? What is their encoding (in vim,:set fileencoding?and in the terminal,$ file /path/to/original/.vimrc)? Please, paste the content of the.vimrcfile you want to use in your question.If you are absolutely certain you need these files to work efficiently in Vim and assuming you actually have a custom
.vimrcsomewhere on your Mac, open Terminal.app and type this command (without the$):$ cp /path/to/original/.vimrc ~/.vimrcto copy your
.vimrcto the canonical location.Now launch MacVim. What do you see? You are supposed to see a window with some introductory text, is that what you see?
If MacVim doesn't work correctly with your
~/.vimrcyou might want to comment its content, relaunch MacVim, uncomment a few lines and so on until you eventually find a bad setting.
回答2:
Just put your .vimrc and .gvimrc into your home directory, i.e. ~/ It's picked up there allright.
BTW, you don't need to link to the homebrew dir. Those rc files are default files which you can override with your local user files.
来源:https://stackoverflow.com/questions/9335098/trouble-with-vimrc-file-recognition-with-macvim