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?
-
Do you still have something open in your question? How can we help you further?– Vivian De SmedtOct 25 at 15:50
-
1Thanks, no your answer is perfect.– mohamadi_archOct 29 at 19:56
-
Thanks for the feedback :-)– Vivian De SmedtOct 30 at 3:29
1 Answer
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\>[^>]*>/