Mixing two syntax highlighting scripts

后端 未结 1 1578
孤独总比滥情好
孤独总比滥情好 2021-01-03 19:44

I write blog posts with Jekyll, and for that I end up using three different languages in the same file: YAML at the start for post metadata, Markdown in the body, and C++ in

相关标签:
1条回答
  • 2021-01-03 20:10

    Quick fix: append syntax on to the last line of your .vimrc, which is the same as setting :syn on in the live session.

    Not So Quick:

    Looks like you might have installed the custom 'jekyll' syntax alongside the default syntax files in $VIMRUNTIME.

    According to Vim wiki section on custom syntax, it's preferable to keep all personal customizations within ~/.vim. For example, putting your jekyll.vim syntax in ~/.vim/syntax/.

    Do not use a directory containing the files distributed with Vim because that will be overwritten during an upgrade (in particular, do not use the $VIMRUNTIME directory).

    In the Vim syntax docs:
    :syntax enable runs ':source $VIMRUNTIME/syntax/DEFAULT_SYNTAX.vim'.
    :syn on (or :syntax on) will "overrule your settings with the defaults".

    So if setting :syntax on makes your custom syntax work, it must be contained in the default syntax set.

    Try keeping all the custom stuff in ~/.vim and see if that settles things.

    0 讨论(0)
提交回复
热议问题