I have a ~/.vimrc file that vim doesn\'t seem to be reading. There is a file at /etc/vimrc, and it looks like it is using that one.
My understanding is that the one
For me, the mistake was I had the configuration set at ~/.vim/.vimrc
.
After reading some documentation, I found that right path is ~/.vim/vimrc
.
Changing the file did the trick.
Once you've loaded vim, :scriptnames
will tell you exactly what Vim read.
For me, it starts like this:
1: /Applications/MacVim.app/Contents/Resources/vim/vimrc
2: ~/.vimrc
3: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syntax.vim
4: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/synload.vim
5: /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/syncolor.vim
IF you want to check where a particular setting is being set, use "verbose set". For example, :verbose set background
tells me:
background=light
Last set from ~/.vimrc
so I know that my setting in ~/.vimrc is being read, and that none of the later files is clobbering it.
I had this problem and just added the following to the file ~/.bash_profile
:
alias vim="vim -S ~/.vimrc"
On OSX 10.8.0 the location of the vimrc file is: /usr/share/vim/vimrc
I just add my changes to the bottom of the file.
Of course this has the effect of making the changes for all users. For the life of me I can't seem to figure out how to get it to read ~/.vimrc. This was never an issue for me on 10.6.x
Anyway this is a quick fix even it is a bit dirty.
Cheers
Check if $VIMINIT
has been set. It may prevent reading your ~/.vimrc
. See :help VIMINIT
:
c. Four places are searched for initializations. The first that exists
is used, the others are ignored. [...]
- The environment variable VIMINIT [...]
For me unsetting VIMINIT
did the trick, my ~/.vimrc
is now read.
After checking scriptnames
and verbose
as suggested above, I noticed that my setting was indeed being loaded, but being overridden by another plugin, thus giving the impression that it was not reading/loading the .vimrc
.
If this happens to you and you want to override a specific setting from a plugin, without completely eliminating all the other good things that come from that plugin, you can create a config file to load after the plugin is loaded, by creating a file in ~/.vim/after/<path>/<plugin_name>
. For reference, see this other question.