Sublime Forum

Indent Guides

#1

EDIT: download the most recent version from here: 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.
indent_guides.py.zip (733 Bytes)

0 Likes

Vertical Line Guides
#2

Nice! Please add tabs though :smile:

0 Likes

#3

Nice! Iā€™ve set the scope to ā€œguideā€ and added a special color to my theme for that.

0 Likes

#4

yeah tabs is a must, i donā€™t see myself using this without tabs. i tab myspace all the time.

0 Likes

#5

How did you do that?

I canā€™t get them working?

0 Likes

#6

[quote=ā€œjbrooksukā€]How did you do that?

I canā€™t get them working?[/quote]

Add this to your theme file e.g. right before the comment block:

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

view.add_regions('ElasticTabstopsCommand', regions, 'comment', sublime.DRAW_EMPTY)
0 Likes

#7

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.
indent_guides.py.zip (1.25 KB)

0 Likes

#8

Tabs donā€™t seem to be working for me :frowning:

0 Likes

#9

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ā€¦

0 Likes

#10

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?

0 Likes

#11

[quote=ā€œadzenithā€]

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?[/quote]

I was able to get it working in the first version, but this one will not display guides for tabs or spaces O_o

Yes, Iā€™ve added a status_message in the first class and that displayed. I also added the user settings.

0 Likes

#12

Iā€™m sorry to throw in this a bit late but Iā€™ve reworked the older version a bit. Perhaps you want to adapt the changes in the attachment.

Iā€™m now going to test your newest versionā€¦
indent_guides_patch.zip (3.35 KB)

0 Likes

#13

Hereā€™s a new version thatā€™s cleaned up a lot and includes theblacklionā€™s changes.
indent_guides.py.zip (1.63 KB)

0 Likes

#14

Yeah - that works nicely - thanks! :smile:

0 Likes

#15

[quote=ā€œtheblacklionā€]

Yeah - that works nicely - thanks! :smile:[/quote]

Didnā€™t work for me.

Latest build, Windows 7 64Bit

Sad because I like them being there :frowning:

0 Likes

#16

You have

"show_indent_guides": true,
in your user file prefs?

0 Likes

#17

Looks great! ā€¦hey, is there any way to make guides be one pixel width instead of two?

0 Likes

#18

[quote=ā€œadzenithā€]You have

"show_indent_guides": true,
in your user file prefs?[/quote]

Yes.

0 Likes

#19

Unfortunately I believe this is impossible at the moment.

0 Likes

#20

[quote=ā€œjbrooksukā€]

[quote=ā€œadzenithā€]You have

"show_indent_guides": true,
in your user file prefs?[/quote]

Yes.[/quote]

Do you have any other data you can give me? Itā€™s hard for me to fix it if it works over here and I donā€™t know why it doesnā€™t work over there.
Thanks!

0 Likes