1

Can we set different colours for different tags in HTML syntax? For example, set a tags to green and div tags to yellow. In VsCode this extension makes HTML tags coloured inside .html, .jsx, .tsx and so on. How can we do this in Vim and Neovim?

3
  • Do you still have something open in your question? How can we help you further? Oct 25 at 15:50
  • 1
    Thanks, no your answer is perfect. Oct 29 at 19:56
  • Thanks for the feedback :-) Oct 30 at 3:29

1 Answer 1

0

You can enrich the html syntax.

You can create a ~/.config/nvim/after/syntax/html.vim:

highlight Green guifg=Green
syntax match Green /<a\>[^>]*>/

highlight Yellow guifg=Yellow
syntax match Yellow /<i\>[^>]*>/

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.