I was toying around with my .vimrc
editing it, and then checking in another file whether my changes worked or not.
But now I ended up in a state where opening one file with vim file1.tex
(this was the one I used for testing) doesn't load syntax highlighting and using vim file2.tex
loads the syntax highlighting.
My thought was that maybe I accidentally set something specific for file1.tex
which persists, but the only info I found was .viminfo
and deleting that did not help.
:autocmd
that matches the filename from your.vimrc
could very well be the reason. Try with a minimal.vimrc
(that only enables filetype detection and syntax highlighting). I would guess that the problem is gone then. If it isn't, you have to dig deeper; I would open the file from within Vim with:20verbose edit file1.tex
and check the logs.:autocmd
output itself. The event probably isBufRead
.:set ft?
on the problem file, to make sure the file type is being set correctly (compare it to other files or a copy of this file on a path that works...)