Mantis
Mantis

Reputation: 1387

.vimrc being overwritten. Not all settings working

My ~/.vim/.vimrc seems to be overwritten as some custom settings seem to work whilst others don't. For example set number does not work. If i type :set number in vim it does work. If i do vim 'filename' -u 'path/to/.vimrc' it does work

I have looked into this and one post suggested updating from the mac vim 7.3 to 7.4 but that didn't seem to do the trick.

:version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 15 2015 16:09:04)
MacOS X (unix) version
Included patches: 1-963
Compiled by Homebrew

system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/local/share/vim"

Upvotes: 0

Views: 986

Answers (2)

Kent
Kent

Reputation: 195029

The vimrc config files are searched in the order the first that exists is used, the others are ignored. The $MYVIMRC environment variable is set to the file that was first found, unless $MYVIMRC was already set and when using VIMINIT.

From your :version output, vim looks for user vimrc files in order:

...
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
...

If you have $HOME/.vimrc file, it will be read and used for vim configuration.

If you don't have that file, your ~/.vim/.vimrc will not be read any way, because vim looks for "~/.vim/vimrc" without the dot.

Upvotes: 2

Durga Swaroop
Durga Swaroop

Reputation: 583

A similar thing happened to me once. Try putting the lines which you think are getting overridden, at the end of the file. So, in this case try with set nu

If this does, then you can be sure that some other command in the middle is messing it up. So, try it and see if it that resolves it.

Upvotes: 0

Related Questions