Sublime Forum

Elastic tabs


As Sublime Text is THE cutting-egde-text-editor, it could be interesting to implement this:

What do you think?


Congrats on the new forum

really nice, but what if i open this file in another ‘plain’ editor, i will see a mess… as well as if i send this file to a friend, etc. the problem is it is not standard behavior.



Yeah, it should be optional, of course…

… or implemented as a plugin, if possible.



Upvote! End the tabs vs. spaces war!



Another upvote. This would be a marvelous option.



Actually, when the file is opened in another editor, it looks perfect, because the file is saved with spaces only.

It’s been done for gedit ( When you open the file, it’s internally converted to tabs, and when you save it, it’s converted back to spaces.

I think we could make this work in Sublime if there was a way to set non-uniform tabstops on different lines.



I just wanted to bump this thread! :smile:
Will we see something like this in Sublime Text X?



Awesome ! A must have !
I want this feature !



I’m personally not a fan of elastic tabstops, primarily because they significantly increase the cost of laying out text: it changes the problem from a local, per-line one, into a global problem: a modification on one line can change how every line in the buffer is rendered.

Although I haven’t used any software that supports elastic tabstops, I suspect that in the real world, they aren’t as handy as they seem: because layout is now global, a very long variable name in once function can introduce excessive whitespace in every other function in the file (i.e., blocks will be aligned with other blocks hundreds of lines away).

The primary problem elastic tabstops solve is preserving vertical alignment of neighboring blocks of text. I believe this would be better solved by the editor doing so explicitly, inserting normal whitespace as required.



I don’t understand why you speak of align the whole text and at the end only of lines above or belove the current line.
The elastic tabstop works only for the lines above or belove the current line when you have at least N numbers of elastic tabstop, where N is greater than or equal the N of the current line.



As oxman said, you only need to look at nearby lines that are similarly tabbed. There’s a Java applet at this page that lets you play around with elastic tabstops.

I’ve actually been thinking about making a Sublime plugin that replicates the behavior of elastic tabstops through capturing the tab key and replacing it with a certain number of spaces, then looking at nearby lines and modifying them. If I find some time I’ll throw something together. This use of spaces instead of tabs would also mean that the text would be completely portable into other editors.



Oh, yes, my mistake!

This is a problem better solved in the editing layer rather than during layout, however.



+1 for this feature :smile:



If you like this feature, you can vote on … p-feature/ :wink:

1 Like


Unless we use proportional fonts.

With elastic tabstops and better looking special characters, using proportional fonts could be cool.

Imagine using a serif font for large comments, and a sans serif font for code.
And bigger character size for class declarations, and for

And array indices in superscript.

Maybe I’m a bit crazy, but compare a nicely rendered math formula to a plain text one in notepad…

Clicking on the minimap should also act like google earth: zoom out until the destination is visible, then zoom in, closing in on the destination rectangle.

I also want particle effects on syntax errors.

Of course, I’ll still be happy if these features only make it in 2.1 :confused:

Seriously though… A pretty-printer/code-beautifier can do the same job as elastic tab stops.
Unless we use proportional fonts.

1 Like


I would never use this. It’s a very cool thing, but a) I use spaces, and b) it would be a major visual disruption if it started working when you didn’t intend it to.

Seems like a lot of interface work just to help make your code pretty. And as others have mentioned, exporting to an editor which didn’t have this feature would expose your “pretty” code for the mess it really is. I downvote.



No, the file would be saved with spaces



I don’t see why this wouldn’t be possible with a plugin to be honest. You’d only need to look between regions and the current line.

Not saying I could do it, but from what I understand of the plugin system (at least in V1.4) I see no reason for it not to be done?



I’m actually working on a plugin for elastic tabstops right now.




I’m actually working on a plugin for elastic tabstops right now.[/quote]

Cool! Looking forward to seeing it!