Home Download Buy Blog Forum Support

Indent Guides

Indent Guides

Postby adzenith on Thu Feb 10, 2011 5:17 am

EDIT: download the most recent version from here: https://github.com/SublimeText/IndentGuides



This file, when placed in your packages directory, will make little indent guides show up on the left side of your buffers.
It only works if you indent with spaces, stemming from a combination of it being late and me only indenting with spaces.
So... go for it. Let me know if it doesn't work. I might add tab support later if there's demand.

It's in a zip file because the forum won't let me upload .py files. Strange.
Attachments
indent_guides.py.zip
(733 Bytes) Downloaded 1135 times
Last edited by adzenith on Fri Aug 05, 2011 4:56 pm, edited 3 times in total.
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Indent Guides

Postby jbrooksuk on Thu Feb 10, 2011 9:03 am

Nice! Please add tabs though :)
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Indent Guides

Postby theblacklion on Fri Feb 11, 2011 8:29 am

Nice! I've set the scope to "guide" and added a special color to my theme for that.
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Indent Guides

Postby sublimeuser on Fri Feb 11, 2011 11:25 am

yeah tabs is a must, i don't see myself using this without tabs. i tab myspace all the time.
sublimeuser
 
Posts: 6
Joined: Fri Feb 11, 2011 5:57 am

Re: Indent Guides

Postby jbrooksuk on Fri Feb 11, 2011 3:27 pm

theblacklion wrote:Nice! I've set the scope to "guide" and added a special color to my theme for that.

How did you do that?

I can't get them working?
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Indent Guides

Postby theblacklion on Fri Feb 11, 2011 6:03 pm

jbrooksuk wrote:How did you do that?

I can't get them working?


Add this to your theme file e.g. right before the comment block:
Code: Select all
      <dict>
         <key>name</key>
         <string>Guide</string>
         <key>scope</key>
         <string>guide</string>
         <key>settings</key>
         <dict>
            <key>fontStyle</key>
            <string>italic</string>
            <key>foreground</key>
            <string>#EDF2E9</string>
         </dict>
      </dict>


In indent_guides.py replace the word "comment" with "guide" in this line:
Code: Select all
view.add_regions('ElasticTabstopsCommand', regions, 'comment', sublime.DRAW_EMPTY)
theblacklion
 
Posts: 67
Joined: Sat Feb 05, 2011 10:07 pm
Location: Hannover, Germany

Re: Indent Guides

Postby adzenith on Fri Feb 11, 2011 8:45 pm

Here's an updated version with tab support and theblacklion's theme additions.
Some of the code I adapted from code in Jon's indentation.py.
Let me know if you find any bugs.
Attachments
indent_guides.py.zip
(1.25 KiB) Downloaded 5964 times
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: Indent Guides

Postby jbrooksuk on Sat Feb 12, 2011 12:43 am

Tabs don't seem to be working for me :(
jbrooksuk
 
Posts: 781
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Indent Guides

Postby aroberge on Sat Feb 12, 2011 1:07 am

I prefer indent guides not to appear on column zero; so I changed line 65 to read:
if pos % tab_size == 0 and pos != 0:

Now, if only it were possible to make the indent guide thinner...
aroberge
 
Posts: 21
Joined: Sat Feb 12, 2011 1:03 am

Re: Indent Guides

Postby adzenith on Sat Feb 12, 2011 1:40 am

jbrooksuk wrote:Tabs don't seem to be working for me :(

Are you running the most recent build? Is it working in files with spaces, and just not ones with tabs, or is it not working at all? Can you confirm the plugin is running by throwing a print statement at the top of the main function?
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 6 guests