I want to conceal variables with names based on Greek symbols and turn them into their Unicode equivalent symbol, similarly to how vim-cute-python works. For instance, I have this:
syntax match scalaNiceKeyword "alpha" conceal cchar=α
defined in a file for concealing within Scala files which works great except that it's overly aggressive. If I write alphabet
it then gets concealed to become αbet
, which is noticeably wrong.
How can I modify or expand this conceal statement so that it only conceals keywords that match [ _]alpha[ _]
? In other words, I want the following conversions:
alpha_1 => α_1
alpha => α
alphabet => alphabet
Note: This is similar to this question, however it seems like it's slightly more complicated since the group environment I want to match is spaces and underscores. Naively defining a syntax region like the following makes things all kinds of wrong:
syn region scalaGreekGroup start="[ _]" end="[ _]"
Thanks in advance!
Modify the pattern to match only the names delimited by word boundaries or underscores:
:syntax match scalaNiceKeyword '\(_\|\<\)\zsalpha\ze\(\>\|_\)' conceal cchar=α
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With