I try to inline one syntax in another syntax (to be explicit: CSS in JS template strings). I'd like to build on top of the existing CSS definitions and not create new ones.

Question: Is it possible to access previously defined syntax matches/keywords for access in other syntax definitions?


Imagine the following definition:

syn keyword cssPseudoClassId contained link visited active
syn match   cssPseudoClassId contained "\<first-\(line\|letter\)\>"

How do I access cssPseudoClassId to include it in another syntax definition to not re-write it manually.

syn region customWhatever transparent fold
        \ start=":".cssPseudoClassId end="\ze\(,\|;\|...\)"
        \ skip="\\\(`\|\$\)" ...
        \ contains=css.*Prop,...

Any other tips are highly appreciated. 😊 🙇

  • To resolve this particular issue I may get by, by adding cssPseudoClassId to the contains-section. But the general question would still be interesting to have answered.
    – fleischie
    Sep 23, 2017 at 6:30


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.