Sublime Forum

Bash Syntax Highlighting for Variable Nanes

#1

I would like to have variable names such as $VAR or $(VAR) highlighted, which doesnt seem to work right now - see attached. Also attached are my packages.

I was able to change Shell-Unix-Generic.tmLanguage using Package Resource Viewer to highlight some words I would like, but I don’t know how to edit it further to get the variables highlighted…

Thanks for your help.

1 Like

#2

This might not be exactly what you’re looking for - but I managed to find a way to get bracketed shell variables (e.g. ${VAR}) syntax-highlighted by altering my color scheme’s .tmTheme file.

This was not working in my color scheme because variable.other.bracket.shell was not defined in the .tmTheme file and I simply had to add that section to the xml. It works great now.

I’ve documented that here: https://www.evernote.com/l/AOjnNvZhqnNEAZAVNebimtK-eR5TwSvn2bs and I hope it might help.

1 Like

#3

Thank you a lot! This was immensely helpful.

0 Likes

#4

Note that you can always look at the scopes the syntax creates by clicking on Tools -> Developer -> Show Scope Name. See this GitHub issue for a somewhat general overview on what scopes you should be targeting in your color scheme for nice colorings.

0 Likes