Reputation: 189
So I am working in a javascript project. And I have some code like this:
I am using the vim-javascript plugin and it has these lines on syntax/javascript.vim:
syntax keyword jsOperator delete instanceof typeof void new in of
syntax match jsOperator /[\!\|\&\+\-\<\>\=\%\/\*\~\^]\{1}/
But I would like to add different syntax to these files in my after/syntax file, something like jsNew
to new
keyword so I could highlight it with different color. I am trying commands like this:
syntax keyword jsNew new containedin='jsOperator'
But it is not working. What would be the correct way to highlight the new
keyword with no change to the syntax file that comes with the vim-javascript plugin?
Upvotes: 1
Views: 422
Reputation: 101
I had success with these commands in my ../after/syntax/javascript.vim:
syntax keyword jsNew new
syntax cluster jsExpression add=jsNew
hi def link jsNew Special
now the 'new' keyword is highlighted with the color for the highlight group: Special.
Upvotes: 2