CodeMirror variables mode

This is a CodeMirror mode that brings syntax highlighting for variables in strings.

MIME types defined:

Options:

Direct use

By default, codemirror-mode-variables supports $-prefixed variables with optional braces, e.g. $foo or ${bar}:

Custom variable patterns

Braces:

Brackets:

Apache-style:

printf-style:

Use as nested mode

Below is a demonstration of how the variables mode can be used to highlight variables within other languages (here, nginx).