2

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 at 15:10
2

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

:h au

Then create a group (scope as the understood term) to protect yourself from duplicate definitions (just like an include guard in C)

augroup debianlatexfix 
  " Remove all vimrc autocommands within scope
  autocmd! 
  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 – Christian Brabandt Feb 6 at 13:09
  • @ChristianBrabandt Cool beans. Prob should tell that to the questioner though. – Jonathan Komar Feb 6 at 13:10
1

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. – Léo Léopold Hertz 준영 Sep 4 '16 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. – Brian Tiffin Sep 4 '16 at 9:09
0

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, privacy policy and cookie policy

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