[TxMt] select paragraph | code block

David Lee david at davelee.com.au
Mon Apr 4 09:30:27 UTC 2005


What I used is workable for many tasks, but is no good if you want to 
select beyond the immediate containing block (eg, if you want to select 
a function while you're in a loop). I think this kind of text selection 
merits planning in, if only because there will ultimately be so many 
applications for filters & unix tool integration with TextMate.

To be useful to me it needs to be language-independent. Would using the 
code folding definitions of what constitutes a block achieve 
generality? That way there'd be no reinventing the wheel, and  
selection will mature with the bundles.

The paragraph selection tool could be useful for coding AND prose with 
only slight modification. If it consistently treated a single line 
containing nothing OR only whitespace as a break (at the moment a lone 
tab is enough to make the line 'part of a paragraph'), that would help 
a lot and to my mind lose nothing.

Going beyond that, if, when triggered repeatedly it would
1st select the containing 'code block' (ie, as above but ignoring all 
blank lines)
2nd+ select progressively outer 'code blocks',
that would be it sewn up (methinks).

Now if you wanted to get really carried away, you could have, say, 
ctrl-alt-opt-(up or down) move blocks of selected text in semantically 
sensible ways (eg with a function selected, move up one function 
definition at a time) which would be nifty for refactoring code.

my opinions only


On 04/04/2005, at 7:13 AM, Allan Odgaard wrote:

> On Apr 2, 2005, at 2:46, David Lee wrote:
>> now this should start a new thread.
> Thanks! :)
>> a) a bug in 'select paragraph' , or
>> b) plans for a version of it that will select the 'code block' you're 
>> working on
> Select paragraph is indeed for prose. If you by 'code block' just want 
> stuff inside e.g. {...} then yes, I'll add such a function.  For more 
> advanced stuff, like e.g. what would be a code block in ruby 
> (class/def/do ... end) this will need some more thoughts about how to 
> make it general.
> The new syntax system might be helpful here, but I'm not entirely sure.
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

More information about the textmate mailing list