I get no syntax highlight now in Debian's Vim by the workflow which works in Ubuntu 16.04: installation of packages and activating syntax

  1. installation apt-get install vim texlive-full
  2. activation in Vim, :set syntax=latex

I know that the Texlive is working because I get correct LaTeX syntax in Geany.

Debian: 8.5
Vim: release of the year 2006

  • Vim version can be found out with :ver (post only 7.x.xxxx). Please mention if you have a personal vimrc. You need syntax on. The filetype for latex is tex, not latex. For tex it is plaintex. The sentence I know that the Texlive is working because I get correct LaTeX syntax in Geany. is not true: syntax highlighting in editors (geany, vim, ...) works without having texlive installed at all and is no indication whether texlive actually works.
    – Hotschke
    Feb 6, 2019 at 15:10

3 Answers 3


And to make it persistent, check out vim's help files under the keyword au for autocmd

:h au

Then create a group (i.e. scope/namespace as the ubiquitous term) to protect yourself from duplicate definitions (just like an include guard in C)

augroup debianlatexfix 
  " Remove all vimrc autocommands within scope
  autocmd BufNewFile,BufRead *.tex   set syntax=tex
  autocmd BufNewFile,BufRead *.cls   set syntax=tex
augroup END
  • That is default on debian. Have a look at $VIMRUNTIME/filetype.vim Feb 6, 2019 at 13:09
  • @ChristianBrabandt Cool beans. Prob should tell that to the questioner though. Feb 6, 2019 at 13:10

There is no latex.vim syntax file that ships with Vim (as far as I know, and see on this Fedora 21 install).

Try :set syntax=context or tex or plaintex or initex

I find context a favourite, but that may be first exposure syndrome and the choice of colours.

  • Nothing of those work. Sep 4, 2016 at 6:40
  • Take a look in /usr/share/vim/vimNN/syntax/ (the NN will be a version spec, likely 70 if your Vim is from 2006), it's vim74 here. See if there are any *tex* files. Make sure :syntax on is on, and check to see if :version shows +syntax. (You may need to install a variant Vim package). And there are choices there, vim-gnome, vim-gtk, vim-nox etc. Sep 4, 2016 at 9:09

Add the following line in $HOME/.vimrc

syntax on

Output: syntax highlight works and their changes too, etc with :set syntax=latex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.