Awesome ! A must have !
I want this feature !
Elastic tabs
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.
If you like this feature, you can vote on sublimetext.userecho.com/feedbac ⌠p-feature/
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
tags.
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
Seriously though⌠A pretty-printer/code-beautifier can do the same job as elastic tab stops.
Unless we use proportional fonts.
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.
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?
[quote=âadzenithâ]
Iâm actually working on a plugin for elastic tabstops right now.[/quote]
Cool! Looking forward to seeing it!
Here it is:
github.com/SublimeText/ElasticTabstops
NOTES
-
You canât use the stock undo/redo/soft undo/soft redo commands, and instead need to use the wrappers that Iâve created for them (in the same file as the plugin). This is because undo and redo trigger on_modified, and on_modified is where this plugin does all of its processing. So every time you undo, the plugin will redo what you just undid, effectively taking away your ability to undo. My wrapper functions warn my plugin that an undo is coming so that it stands down.
-
Because you canât change the width of individual tabstops in Sublime Text, this plugin works by inserting spaces in front of tabs in order to align text. This has the benefit of making your files 100% compatible with editors that donât support elastic tabstops, but adds a couple of quirks to the behavior of the plugin that pretty much canât be worked around.
-
Youâll need to be indenting with tabs.
Let me know of any questions or comments!
Edit: updated link.
Thanks but it donât work for me
Nothing happen.
And I want the same plugin work with space indentation.
And elastic tabstop in real time when I write.
Thanks for your work
The elasticity does in fact happen in real time.
I want the same plugin with space indentation too, but itâs approximately impossible given Sublime Textâs API right nowâwith spaces you have to guess intent, whereas with tabs you just have to count tabs, and Sublime Textâs API doesnât tell you what changes have been made to a buffer (it just tells you that changes have been made), so itâs hard to guess whatâs going on.
In terms of the plugin not working, can you give me more info? Are your files using tabs for indentation? Is the plugin loading correctly? etc.
You can run this for a little info:
import sublime_plugin
sublime_plugin.all_callbacks.items()
If you like this feature, please vote up : sublimetext.userecho.com/topic/1 ⌠p-feature/
If anybody is looking for the elastic tab stops code, it apparently has moved to github.com/SublimeText/ElasticTabstops