Skip to content

Instantly share code, notes, and snippets.

@drazen
Created April 17, 2014 18:14
Show Gist options
  • Save drazen/11002364 to your computer and use it in GitHub Desktop.
Save drazen/11002364 to your computer and use it in GitHub Desktop.
Subdued end keyword in sublime text
Although Ruby is not a whitespace significant language, multiple "end" keywords in the keyword syntax color highlighting can be glaring. If you're consistent with indentation... a loudly colored "end" keyword doesn't add much. So lets tone down the color on the "end" keyword in sublime text.
In ruby.tm-language:
replace
<string>(?&lt;!\.)\b(BEGIN|begin|case|class|else|elsif|END|end|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])</string>
with
<string>(?&lt;!\.)\b(BEGIN|begin|case|class|else|elsif|ensure|for|if|in|module|rescue|then|unless|until|when|while)\b(?![?!])</string>
and add the following XML stanza:
<dict>
<key>comment</key>
<string>isolate 'end' so we can target it for subdued syntax hightlightitn</string>
<key>match</key>
<string>(?&lt;!\.)\b(END|end)\b(?![?!])</string>
<key>name</key>
<string>keyword.control.end.ruby</string>
</dict>
Now in your theme file(s) ex. Tomorrow-Night.tmTheme, add the stanza:
<dict>
<key>name</key>
<string>Subdued end</string>
<key>scope</key>
<string>keyword.control.end</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#444444</string>
</dict>
</dict>
And now you can at least pretend Ruby is whitespace significant ;-)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment