Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vim folding messes up syntax highlighting

I'm using vim for LaTeX and I'm using latex-suite. It gives me nice syntax highlighting and folding, but in large files syntax highlighting gets "confused". If I open all folds, the syntax highlighting turns OK. I would like it to "just work" all the time though.

I seem to recall an option that would increase the number of lines that is used as basis for determining syntax highlighting but I cant find it.

like image 244
svrist Avatar asked Aug 31 '10 09:08

svrist


Video Answer


2 Answers

I don't edit LaTeX, but perhaps you want ":syn sync fromstart"? Just be warned that this can significantly slow down Vim since it forces Vim to do syntax highlighting parsing for the whole file rather than a section of the file. See ::help :syn-sync".

like image 191
Heptite Avatar answered Oct 18 '22 19:10

Heptite


  • Ctrl+L in normal mode forces a redraw and often fixes syntax colour problems.
  • zRzMzx (i.e., expand all folds, contract all folds, fold to show current line) sometimes fixes syntax highlighting problems related to folds
like image 33
Jeromy Anglim Avatar answered Oct 18 '22 19:10

Jeromy Anglim