Reputation: 93
I use echo &filetype
for file I create yestoday with extension .tex and the result is tex
,
but today when I create another .tex file ,this code will get filetype plaintex
, and I check my .vimrc it didn't change.
I want to know why the file extension is same while filetype is not, how can I let them to be the same
Upvotes: 0
Views: 64
Reputation: 15081
Even though the TeX formats are very different, but they all use the same .tex
extension for their source files. Hence Vim tries to guess the correct format by some heuristics.
When nothing else helps Vim assumes it's a plaintex. You can add let g:tex_flavor = 'latex'
to your vimrc to change this.
Read also :h g:tex_flavor
for more info.
Upvotes: 1