I'm trying to write a custom conceal script to replace ==
by ≈
.
However, my syntax match seems to be working only when I put =
and not ==
.
var body = document.body;
if (body == 'body')
console.log('yes');
Everything works fine when I do this:
syntax match jsEqual "=" conceal cchar=≈
When I change it to:
syntax match jsEqual "==" conceal cchar=≈
Nothing is concealed.
I can reproduce this with the vim javascript syntax plugin, but not with the built-in syntax script. That extended syntax defines a syntax group javaScriptOpSymbols
for ==
.
To find out which syntax group causes the highlighting. :syn list
shows all active groups, but it's easier when you install the SyntaxAttr.vim - Show syntax highlighting attributes of character under cursor plugin.
To make your conceal group apply, you need to make it applicable inside that syntax group that covers the ==
; this is done via the :help :syn-containedin
attribute:
syntax match jsEqual "==" conceal cchar=≈ containedin=javaScriptOpSymbols