Sublime Forum

Is there a way to force highlighting as the default color?

#1

For example, I have a Bash script like this:

echo ${foo/search/replace}

Let’s say that ‘foo’ is variables, and ‘search’ and ‘replace’ are most likely unquoted plain text.

My goal is to highlight ‘search’ and ‘replace’ with the same color of ‘source.shell’.
I.E., most likely white on a dark theme and black on a light theme.
(like http://i.imgur.com/j1BMrby.png on my VIM.)

Currently, ‘search’ and ‘replace’ are under the scope of ‘${…}’ (variable.other.bracket.shell) hence they are not the same color with source.shell.
I tried to add ‘scope: source.shell’ to them but in vain.
'source.shell variable.other.bracket.shell source.shell` is still rendered as ‘variable.other.bracket.shell’.

Any way to achieve this?

0 Likes

#2

Update your color scheme and add a new more specific rule and add your own color to it.

		<dict>
			<key>name</key>
			<string>My Custom Color for search/replace</string>
			<key>scope</key>
			<string>source.shell variable.other.bracket.shell source.shell</string>
			<key>settings</key>
			<dict>
				<key>foreground</key>
				<string>#FFFFFF</string>
			</dict>
		</dict>
0 Likes

#3

[quote=“aziz”]Update your color scheme and add a new more specific rule and add your own color to it.

<dict> <key>name</key> <string>My Custom Color for search/replace</string> <key>scope</key> <string>source.shell variable.other.bracket.shell source.shell</string> <key>settings</key> <dict> <key>foreground</key> <string>#FFFFFF</string> </dict> </dict> [/quote]

Thanks for your reply.
This may work in this case but ‘variable.other.bracket.shell’ is just a single case.
It could be ‘source.shell blah1 blah2 blah3 … source.shell’.
Finding all combination is impractical.

Sounds like I have to add a new personal for this… rather than ‘source.shell’.

0 Likes