I noticed that when I create a .tex
from within Vim itself, in a later session that file is detected as plaintex
, while already existing files are detected with the tex
filetype (note: both of them have the .tex
file extension).
I noticed it, since the syntax highlighting was different between the two.
I then created after\ftplugin\plaintex.vim
in which I added
set filetype=tex
which does change the filetype
, but it does not apply the relative syntax highlighting. I guess because this is done after the buffer is already loaded and processed.
I then tried with ftdetect/plaintex.vim
with
setfiletype tex
set filetype=tex
It didn't work either.
I think the last option would be to work with either filetype.vim
or script.vim
to set filetype before built-in detection.
How can I make Vim assign the "tex"
filetype when creating .tex
files?
I've been trying to solve this myself, without success.
Texlab
LSP installed (using Neovim). So, I guess for the matter, it is like vanilla vim.