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
    Apr 18 at 22:54
  • 2
    Perhaps via an autocommand
    – D. Ben Knoble
    Apr 19 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
    Apr 23 at 12:24

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.