Elastic Tabs
Nick Gravgaard proposed a new concept called Elastic Tabs.
Since this has gotten a lot of buzz here is the reply I sent to the mailing list (and a few people who wrote me in private):
Indeed it is interesting. I do think there would be too big a compatibility problem with actually saving such files, since all renderings of the file (
cat
it in terminal, paste it in an email, on the web, etc.) would be wrong — and it’s not easily fixable, e.g. by piping the text through something likeexpand
, which would normally fix presenting a file with the wrong tab size.But the actual editing mode might be useful to have. I’ll need to give it some further thoughts.
I have considered expanding the current smart tab behavior so that if tab is pressed while at the end of the line (rather than start) it would insert enough padding to align with what’s on the line above – I am however skeptical about this going to “feel right” instead of just getting in the way. But it’s worth doing some prototyping.
In a follow up Drew McLellan writes:
I use tabs for aligning assignment blocks, and so often find myself going back up to add extra tabs when the left side of the assignments becomes longer than I expected.
Daniel Käsmayr points to column selections as something which does ease this (and indeed it does, well, technically that would be column typing) but there actually is a TextMate command to align equal signs in a block by Chris Poirier.
Unless Chris objects, I will probably include this in the default source bundle, seeing how this is a frequent task done by people who like their assignment blocks aligned.