I notice when I work with larger Mardown files, the syntax highlighting is broken if I skip around the page. This seems to fix the issue:

syntax sync minlines=999

but if I put it into my _gvimrc, it doesnt do anything. Is it possible to save this setting?

2 Answers 2


The issue you're having is that syntax configuration is loaded for specific filetypes in Vim, so you want that change to apply for the Markdown type, so it's loaded as part of syntax rules (more specifically, after the built-in syntax rules) whenever you open a file of that type.

You can add more syntax rules for Markdown files by creating a file with path ~/.vim/after/syntax/markdown.vim (or %HOME%\vimfiles\after\syntax\markdown.vim on Windows) and add the syntax sync minlines=999 to that file.

  • Thank you for the answer. However I dont want a Markdown specific solution. Is a general solution available?
    – Zombo
    Commented Apr 18, 2022 at 22:54
  • 2
    Perhaps via an autocommand
    – D. Ben Knoble
    Commented Apr 19, 2022 at 14:33

This seems to do it:

let g:markdown_minlines = 999
  • This is probably documented somewhere (maybe :help ft-markdown?). Adding the reference would improve this answer
    – D. Ben Knoble
    Commented Apr 23, 2022 at 12:24

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.