Home Download Buy Blog Forum Support

Indent Guide?

Indent Guide?

Postby AndrejMitrovic on Sun Feb 28, 2010 4:25 am

Hi, I've just discovered this text editor. When I saw the words "The text editor you'll fall in love with", I rolled my eyes. But boy, I think I have a new crush!!

Anyways, is there an option to display the Indentation Guides? There's an option to display whitespace - drawWhiteSpace all -, that's pretty nice. But I'd only want the indentation whitespace to be shown, not necessarily _all_ of the whitespace (e.g. the 1-char wide whitespace between variables get's displayed in this mode as well)

Come to think of it, I might be able to do this in a python script. But maybe it's a hidden option somewhere. Here's hoping. :)

Cheers!
AndrejMitrovic
 
Posts: 7
Joined: Sun Feb 28, 2010 4:16 am

Re: Indent Guide?

Postby Anomareh on Sun Feb 28, 2010 7:29 am

I asked about it earlier as well and there is indeed no option for it. If you do happen to write a plugin for it please share it! This is one of those little things I've missed swapping to Sublime as well.
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Indent Guide?

Postby Xikeon on Mon Mar 01, 2010 10:43 pm

Hey,

I've just finished this addon. It needs a few edits to work, but then it's fine for use. First of all edit the theme you use and add:

Code: Select all
      <dict>
         <key>name</key>
         <string>Whitespace</string>
         <key>scope</key>
         <string>whitespace</string>
         <key>settings</key>
         <dict>
            <key>foreground</key>
            <string>#272822</string>
         </dict>
      </dict>


Change the hex color (#272822) to the one of the background (in settings, the main view background).

Now here's the addon:
http://pastebin.com/Gqjv4zVc

Here's Default.sublime-keymap:
http://pastebin.com/cNUakwkV

Name the folder and file HighlightWhitespace and it should work fine. I don't know how to make a sublime-package file, if anyone does please tell me how so I can make one. (:

If it doesn't highlight (after restart) try to press ctrl+shift+W and it should work.

Hope it helps.

Edit:
Managed to get the sublime-package. Here is the download: http://ckers.nl/sublime/HighlightWhites ... me-package
Just download the package and double click it and it will be installed. Remember: You still have to edit your theme with the code above!
Then restart Sublime and press ctrl+shift+w to activate.
Xikeon
 
Posts: 18
Joined: Fri Feb 26, 2010 5:30 pm

Re: Indent Guide?

Postby Anomareh on Tue Mar 02, 2010 1:55 am

Hrmm, can't get it to do anything for me.

I changed my theme as said to the background. I also tried just changing it to something obvious like white. Also nothing. I tried different settings with drawWhitespace, thought that might be an issue. Also had no effect.
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Indent Guide?

Postby Xikeon on Tue Mar 02, 2010 6:45 am

Hmm, that's awkward. Are you getting errors in the console? (Ctrl+~). And in what position did you insert the theme code? I inserted it just below comment, and copied that <dict>. Maybe you could try that, not sure if it's different in other styles. Here's how mine looks:
Image

Edit:
Just installed this at work and works fine. Are you using a different theme than default? (Monokai Bright)
Xikeon
 
Posts: 18
Joined: Fri Feb 26, 2010 5:30 pm

Re: Indent Guide?

Postby Anomareh on Tue Mar 02, 2010 11:04 am

Code: Select all
Unknown external include source.applescript included from source.shell


But I get that regardless if your plugin is installed or not.

Edited monokai bright exactly as said. Nothing happened.

Your image was removed, if you could reup it that'd be great.
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Indent Guide?

Postby Xikeon on Tue Mar 02, 2010 11:39 am

Hmm, no idea why it got removed.. I've now uploaded it to my own server:
Image
( http://ckers.nl/sublime/whitespace.png )
Xikeon
 
Posts: 18
Joined: Fri Feb 26, 2010 5:30 pm

Re: Indent Guide?

Postby Anomareh on Tue Mar 02, 2010 2:53 pm

That is where I copied the style block.

Is the indent guide not active in that screenshot or am I misinterpreting what you mean by indent guide?
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Indent Guide?

Postby Xikeon on Tue Mar 02, 2010 3:53 pm

I don't use it myself, so it was turned off. What OS are you running and did you try to press ctrl+shift+W? I'm on Windows 7 at home and Windows XP Profesional at work and works on both here.

Maybe anyone else who can try it out to see if it works?
Xikeon
 
Posts: 18
Joined: Fri Feb 26, 2010 5:30 pm

Re: Indent Guide?

Postby AndrejMitrovic on Tue Mar 02, 2010 4:17 pm

I got the following:

Image

So it does work. But can I change the background of the displayed whitespace? Changing the <string> value doesn't seem to make any difference:

Code: Select all
        <dict>
         <key>name</key>
         <string>Whitespace</string>
         <key>scope</key>
         <string>Whitespace</string>
         <key>settings</key>
         <dict>
            <key>foreground</key>
            <string>#000000</string>
         </dict>
      </dict>


Also, the script seems to highlight empty newlines. But great work so far, thanks!

Edit: Ah, a simple regex script. I've been sick the last few days so I haven't even touched Python unfortunately. Thanks for all your work.
AndrejMitrovic
 
Posts: 7
Joined: Sun Feb 28, 2010 4:16 am

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 10 guests