I would like to highlight a code block per instance completely in yellow.

here is everything printed yellow

and here is everything green

How can I achieve this?

  • 1
    Take a look at :help syntax. You'll probably have to write syntax patterns for the regions that interest you, and highlight the corresponding syntax groups accordingly.
    – D. Ben Knoble
    Dec 28, 2021 at 15:57
  • Mh... I tried to :syntax region yellow start=/yellow/ end=// :hi yellow ctermfg=yellow but text did not turn yellow. What di I get wrong?
    – skum
    Jan 3, 2022 at 11:18
  • You can check the syntax groups that apply under the cursor in a variety of ways, e.g., zS from scriptease, my own github.com/benknoble/vim-synstax, etc.
    – D. Ben Knoble
    Jan 3, 2022 at 13:46
  • Hi Ben, I installed your plugin, but it seems to be for investigating syntax. How can this help me to make blocks in a specific color?
    – skum
    Jan 4, 2022 at 8:48
  • The idea was to check the syntax groups to make sure your region was actually applied; if it was not applied, then it would make sense there was no yellow highlighting. It's possible the default markdown syntax rules are overriding your region; I'm not sure of the best way to have your region take priority.
    – D. Ben Knoble
    Jan 4, 2022 at 14:08


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.