[TxMt] Re: Transpose with a more than two characters selected

Allan Odgaard throw-away-1 at macromates.com
Sat Jul 21 11:36:33 UTC 2007


On 21. Jul 2007, at 03:11, Jacob Rus wrote:

> Timothy Bates wrote:
>> [...]
>> Does anybody get value from the current multi-char reverse string  
>> behaviour?

There actually is a ‘rev’ shell command that does exactly the  
same. I have used it only for two tasks:

   1. Sorting based on suffix rather than prefix
   2. Processing text from the right and moving toward the left (e.g.  
inserting thousand separators)

Though neither of this should be suitable for “live editing”.

You could maybe use it for reversing ASCII drawings, like -~= this  
=~- or similar ;) But the behavior just seems consistent with the  
rest…

> Cocoa text fields in general (and TextMate's), have a  
> "transposeWords:" selector, in addition to the "transpose:"  
> selector.  You could assign it to any desired [keystroke][1] you like.

Actually, I do not implement that one. I did initially, and I used it  
for when I got RectFill/FillRect wrong (Java, Cocoa, and AmigaOS all  
either have a RectFill or FillRect call, for Cocoa it’s (NS) 
RectFill, yet Cocoa also has NSEraseRect (i.e. rect last), so I used  
to get that wrong a lot, and placing caret between the two (sub)  
words and transposing fixed it, *except* the NS-prefix (and in Java  
it’s camelCase, so here I’d have to do two extra case conversions)  
-- so when some things changed in the code-base, and it got a little  
complex to fix the transpose words, I didn’t bother with it.

But re-implementing that would likely be more appropriate than  
changing the ⌃T behavior.




More information about the textmate mailing list