I've been using vim daily at work for almost 2 years now, and I've never really had any issues except for in the last two days...
My initial problem was that vim was using 8 spaces for tabs despite my settings in .vimrc. It even refused to let me reset the tab settings from within the vim instance itself. Furthermore, this problem was only happening when editing a specific file, and only while it was named a specific thing (i.e., renaming it fixed the problem). I assumed this must be due to some kind of per-file configuration that I was unaware of, and some searching led me to another post which prompted me to try the following command:
:so ~/.vimrc
This fixed my original problem, but I still don't know what caused it. I didn't do anything that I recall, it just sort of started happening as far as I can tell.
Today I deleted a swap file and all of the sudden my syntax highlighting is gone for a single file (the same one that was affected by the original issue). Again, renaming the file fixes the problem, and it running syntax on has no effect. This time :so ~/.vimrc doesn't alleviate the problem.
Does anyone have any idea what is happening here?
Update: Thanks to Benoit's suggestion I found out that my vim was looking at a file in ~/.vim/view for some settings. When I moved this file, the issue was resolved (and vim created a new version). I'm still not 100% sure happened, but at least now I have something to look into.
Thanks Benoit!!
Your settings are probably modified by filetype specific files.
To know when a setting has been modified:
:verbose set setting?
for example:
:verb set tabstop?
:verb set expandtab?
:verb set shiftwidth?
Also, you could find autocmds for your file type:
:autocmd *.ext
probably some autocmd sets the file type, thus triggering .vim files that modify your settings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With