If one searches for "code that writes code" OR "programs that write
programs" AND vim, one can turn up a number of references to this
kind of activity. Dynamic languages are often more concise than
those with static typing, and while I don't want to get into the
debate on which is better, sometimes it makes sense to use a dynamic
language to generate code in a statically typed language.
So, we run into a problem: how does one syntax highlight mixed
language code? I don't know how others do this. Maybe they don't
and they just look at the generated code to see if it is OK. I'd
like to be able to do syntax highlighting for arbitrary language
pairs, preferably without having to heavily hack the syntax files.
I'm thinking I could insert something into my .vimrc so that I could
invoke that and certain syntax regions would be treated as being in
the other language. Is this possible, and is it relatively easy?
Usually it will be strings in the one language that must show up in
the other.
Thank you,
Hugh