Sublime Forum

Indent Guide?

#1

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. :smile:

Cheers!

0 Likes

#2

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.

0 Likes

#3

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:

<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:
pastebin.com/Gqjv4zVc

Here’s Default.sublime-keymap:
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: 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.

0 Likes

#4

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.

0 Likes

#5

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 . Maybe you could try that, not sure if it’s different in other styles. Here’s how mine looks:


Edit:
Just installed this at work and works fine. Are you using a different theme than default? (Monokai Bright)

0 Likes

#6
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.

0 Likes

#7

Hmm, no idea why it got removed… I’ve now uploaded it to my own server:
http://ckers.nl/sublime/whitespace.png
( http://ckers.nl/sublime/whitespace.png )

0 Likes

#8

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?

0 Likes

#9

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?

0 Likes

#10

I got the following:

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

        <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.

0 Likes

#11

Oops, nevermind, I had a typo:

        <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>

The second string needs to be “whitespace”, not “Whitespace” (with a capital W). Now it’s working fine:

0 Likes

#12

Yes, it’s case-sensitive. Glad it works for you. Weird that it doesn’t for Anomareh. :mrgreen:

0 Likes

#13

Yeah no idea why it’s not working : /

I’m on XP and tried the bind. Nothing happened.

Also something more along the lines of this would be awesome if it was possible. Like is it possible to just draw certain tabs as a left aligned dotted line? Another idea I had was possibly using the ruler feature? I wonder if it’s possible to hook into that code and draw multiple ones?

0 Likes

#14

I think this does what you’re looking for: viewtopic.php?f=5&t=1621&p=7398s#p7398

0 Likes

#15

I would like this to happend as soon as the editor is loaded…

How do I do that?

BTW, a BIG thanks for the plugin. I’m trying to ease away from N++ and this is a biggie for me.

0 Likes

#16

[quote=“jaimerod”]I would like this to happend as soon as the editor is loaded…

How do I do that?

BTW, a BIG thanks for the plugin. I’m trying to ease away from N++ and this is a biggie for me.[/quote]

Which plugin are you trying to use?

0 Likes