coin cheung
coin cheung

Reputation: 1107

Syntax highlighting get lost

Sometimes when I open a markdown file, there is no syntax highlight if I do not open from the beginning of the file (when I quit last time leaving the cursor in the middle of the file). I have to jump to previous lines where the syntax highlights exists and run the cursor down such that the lines my cursor passes will recover their syntax highlights.

How could I fix this problem, or is there any command for me to refresh the syntax highlight so that I could run it when I open the file/buffers ?

Upvotes: 4

Views: 682

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172768

$VIMRUNTIME/syntax/markdown.vim (in the version from 2016 Aug 29 that I have) uses :syn sync minlines=10. You can read about the possible sync approaches at :help :syn-sync. The sledgehammer method would be :syntax sync fromstart (put e.g. in ~/.vim/after/syntax/markdown.vim) to force syncing from the start. You can try that out, or tweak the original minlines= value. What works depends on the complexity of your markdown files.

Upvotes: 3

Related Questions