Hey Drew,
---------- Forwarded message ---------- From: Drew McLellan lists@allinthehead.com
I'd like to see this as an editing mode, automatically managing real tabs/spaces for me.
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. Example (using 4 spaces for a tab here):
$a = 'A'; $bb = 'B'; $ccc = 'C';
If I were to enter a forth line with a really long variable name, I'd *love* for the behaviour to be result in:
$a = 'A'; $bb = 'B'; $ccc = 'C'; $really_long_name = 'foo';
.. but for that to be done with real tabs. I think the suggested convention of using a blank line to clear the alignment is a good one.
Not sure if that's useful input or not, but there you have it :)
I've built a TM filter command that will realign assignment blocks. It'll run on the current selection or on a block of statements touching the current line. You can find it at http://random-dreams.org/freeware/textmate/assignment-block-tidier.txt. It's been on my shortlist since then to write a version that can realign entire statements, lining up commas and closing parenthesis and such. I'll probably get to that this month.
Regards, Chris.
On 4 Jul 2006, at 14:56, Chris Poirier wrote:
I've built a TM filter command that will realign assignment blocks. It'll run on the current selection or on a block of statements touching the current line. You can find it at http://random-dreams.org/freeware/textmate/assignment-block- tidier.txt. It's been on my shortlist since then to write a version that can realign entire statements, lining up commas and closing parenthesis and such. I'll probably get to that this month.
Chris, that's awesome. Thanks.
drew.
It would be nice to get other symbols rather than just =, I smell a good JSON cleanup :) I suppose you change these two lines? relevant_line_pattern = /^[^=]+=/ column_search_pattern = / *=/
into something .. :/ How'd you change hat to include at least : (semicolon) into the pattern matching?
Andreas
On Jul 4, 2006, at 15:56 , Chris Poirier wrote:
Hey Drew,
---------- Forwarded message ---------- From: Drew McLellan lists@allinthehead.com
I'd like to see this as an editing mode, automatically managing real tabs/spaces for me.
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. Example (using 4 spaces for a tab here):
$a = 'A'; $bb = 'B'; $ccc = 'C';
If I were to enter a forth line with a really long variable name, I'd *love* for the behaviour to be result in:
$a = 'A'; $bb = 'B'; $ccc = 'C'; $really_long_name = 'foo';
.. but for that to be done with real tabs. I think the suggested convention of using a blank line to clear the alignment is a good one.
Not sure if that's useful input or not, but there you have it :)
I've built a TM filter command that will realign assignment blocks. It'll run on the current selection or on a block of statements touching the current line. You can find it at http://random-dreams.org/freeware/textmate/assignment-block- tidier.txt. It's been on my shortlist since then to write a version that can realign entire statements, lining up commas and closing parenthesis and such. I'll probably get to that this month.
Regards, Chris.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 7, 2006, at 4:29 AM, Andreas Wahlin wrote:
It would be nice to get other symbols rather than just =, I smell a good JSON cleanup :) I suppose you change these two lines? relevant_line_pattern = /^[^=]+=/ column_search_pattern = / *=/
into something .. :/ How'd you change hat to include at least : (semicolon) into the pattern matching?
Andreas
On Jul 4, 2006, at 15:56 , Chris Poirier wrote:
I've built a TM filter command that will realign assignment blocks. It'll run on the current selection or on a block of statements touching the current line. You can find it at http://random-dreams.org/freeware/textmate/assignment-block- tidier.txt. It's been on my shortlist since then to write a version that can realign entire statements, lining up commas and closing parenthesis and such. I'll probably get to that this month.
Regards, Chris.
Howdy.
I made my own version of this puppy complete with support for alignment on any character it comes built-in with support for CSS and Ruby.
For CSS it inserts spaces before {'s and after ;'s & :'s For ruby it inserts spaces before = == => & # only if they have space around them
Check out the code for more details. Everything is eithre set by looking at the scope or by checking ENV variables, so you can extend it to support whatever language you have. I also have a command that uses this to align on whatever character you just copied.
Check it out: http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Support/bin/assignment-block- tidier.rb http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Commands/Align%20=.tmCommand http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Commands/Align%20paste.tmCommand
thomas Aylott—subtleGradient
Arr, once again I feel that learning svn is a Good Thing :(
Andreas
On Jul 8, 2006, at 14:33 , thomas Aylott wrote:
On Jul 7, 2006, at 4:29 AM, Andreas Wahlin wrote:
It would be nice to get other symbols rather than just =, I smell a good JSON cleanup :) I suppose you change these two lines? relevant_line_pattern = /^[^=]+=/ column_search_pattern = / *=/
into something .. :/ How'd you change hat to include at least : (semicolon) into the pattern matching?
Andreas
On Jul 4, 2006, at 15:56 , Chris Poirier wrote:
I've built a TM filter command that will realign assignment blocks. It'll run on the current selection or on a block of statements touching the current line. You can find it at http://random-dreams.org/freeware/textmate/assignment-block- tidier.txt. It's been on my shortlist since then to write a version that can realign entire statements, lining up commas and closing parenthesis and such. I'll probably get to that this month.
Regards, Chris.
Howdy.
I made my own version of this puppy complete with support for alignment on any character it comes built-in with support for CSS and Ruby.
For CSS it inserts spaces before {'s and after ;'s & :'s For ruby it inserts spaces before = == => & # only if they have space around them
Check out the code for more details. Everything is eithre set by looking at the scope or by checking ENV variables, so you can extend it to support whatever language you have. I also have a command that uses this to align on whatever character you just copied.
Check it out: http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Support/bin/assignment-block- tidier.rb http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Commands/Align%20=.tmCommand http://textmate.svn.subtlegradient.com/Bundles/ tAylott_subtleGradient_BETA.tmbundle/Commands/Align%20paste.tmCommand
thomas Aylott—subtleGradient
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate