Home Download Buy Blog Forum Support

Scheme colours for line numbers and tab characters?

Re: Scheme colours for line numbers and tab characters?

Postby ckovey on Fri Dec 28, 2012 11:54 pm

Hey guys I took the advice given here and split up the whitespace sections a bit: https://github.com/ckovey/sublime-whitespace-coloring

Changing the regex lets me hide whitespace before the code (I like the sublime bars mostly) and make your trailing whitespace red or some color. In my test screenshot I made the first whitespace blue, in-between text whitespace green, and trailing red. Should work for tabs and spaces

Image

Code: Select all
<dict>
  <key>match</key>
  <string>^[\s\t]+</string>
  <key>name</key>
  <string>meta.whitespace.leading</string>
</dict>
<dict>
  <key>match</key>
  <string>[\s\t]+$</string>
  <key>name</key>
  <string>meta.whitespace.trailing</string>
</dict>
<dict>
  <key>match</key>
  <string>[\s\t]+</string>
  <key>name</key>
  <string>meta.whitespace</string>
</dict>


Code: Select all
<dict>
  <key>scope</key>
  <string>meta.whitespace.leading</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#75715E00</string>
  </dict>
</dict>
<dict>
  <key>scope</key>
  <string>meta.whitespace.trailing</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#FF0000</string>
  </dict>
</dict>
<dict>
  <key>scope</key>
  <string>meta.whitespace</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#75715E75</string>
  </dict>
</dict>


There's something in the ruby lang file that makes the whitespace after `do` red, but I haven't looked into that. I mostly wanted to hide leading whitespace and color trailing whitespace
ckovey
 
Posts: 1
Joined: Fri Dec 28, 2012 11:46 pm

Re: Scheme colours for line numbers and tab characters?

Postby Fatbat on Fri Jan 18, 2013 6:45 pm

^^^ That's pretty cool! I just nuke trailing whitespace on save, so I have no real need to colour it differently, but this is still impressive nonetheless.
Fatbat
 
Posts: 70
Joined: Sun Feb 19, 2012 6:54 pm

Re: Scheme colours for line numbers and tab characters?

Postby thei on Sun Apr 14, 2013 5:19 am

That is very useful, thank you.

However, do you know how I can fix the issue where it doesn't always work, especially inside brackets.

For example, if I have (PHP):

Code: Select all
if($x) {
   $code;
}

The tab there will be coloured the colour of something else, in this case source.php.embedded.block.html I think.

The whitespace matching code does not match whitespaces in this instance. How do I alter it so that it does?
thei
 
Posts: 3
Joined: Tue Apr 09, 2013 4:58 am

Previous

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 31 guests