Note: this may be a Windows-only problem. The symptom has been reproduced on multiple Windows 10 machines.
I find my syntax-highlighting for Markdown files (ending in .md
) will fail to rander when there are "code-blocks" of hyper length (say, multiple lines of code that runs longer than the vertical length of the monitor). This usually happened when I jump directly to the bottom of the document using G
in normal mode. Here goes a comparison of the right and wrong syntax-highlighting obtained before and after the "immediate fix" (more details below).
To restore the correct "colorization", I originally was paging down to the bottom of the document using <c-f>
. Lately, I found the following immediate fix that worked within an active Vim session.
Following this suggestion from Issues for Vim on Github, setting :syntax sync minlines=10000
in a buffer does fix the coloring problem immediately. Yet, the fix only stay within the current Vim session and dropping any of the following lines to my .vimrc
did not help to reproduce the immediate solution.
:syntax sync minlines=10000k
autocmd BufEnter,BufRead *.md :syntax sync minlines=10000
set redrawtime=10000 "Suggested by someone else from the vim-Github-issue-page. Did not help in my case.
As a compromise, I am adding an abbreviation for the command line mode as the following:
cab mdd syntax sync minlines=10000
I am looking for a once-and-for-all fix to the syntax-highlighting problem with markdown files.
Please advise if I am missing some handy settings for vim. This only happened on gvim.exe
installed on Windows 10 machines. I have been reusing almost 100% of the .vimrc
settings across Linux, Windows-WSL and Windows machines. Unix-based Vim has been consistently getting the syntax-highlighting correct.
syntax sync fromstart
instead. Arbitrarily large numbers are kinda hacky.