Vim sometimes only partially syntax-highlighting for .tex files
Alec Jacobson
May 12, 2011
Editting .tex files with vim I noticed that sometimes I got full syntax highlighting, but other times only certain keywords were markes and the colors were a bit different. Turns out this was because vim was occasionally recognizing files (based on keywords) as plaintex rather than tex. You can see what filetype vim thinks you have open by issuing:
:set ft
For a bit I was fixing this on a case-by-case basis, if vim's highlighting was wrong I would issue:
:set ft=tex
and that would fix it for at least the current file and session.
The real permanent fix was to add the following to my ~/.vimrc file:
let g:tex_flavor = "latex"
Now all my .tex files are recognized as tex and not plaintex.