[TxMt] get last 3 words

Hans-Joerg Bibiko bibiko at eva.mpg.de
Tue Jun 19 06:48:46 UTC 2007


On 19 Jun 2007, at 04:40, Christoph Koehler wrote:
> I am looking into building my own bundles and was wondering if it is
> possible to somehow get the last 3 or so words before the caret. I
> know there is a variable for the current line and current word, but
> can I somehow get the last 3 or so words even if they are on different
> lines?
>

Well, there're some possibilities to do that.
First in my mind would be if the number of words is fixed, in your  
example three, to record a macro:

moveWordRight
moveWordLeftAndModifySelection
moveWordLeftAndModifySelection
moveWordLeftAndModifySelection


and bind it to any key equivalent

In general the macro will do:
1: place the caret at the end of the current word
2...4: expand the selection word by word

hans

-------------- next part --------------
A non-text attachment was scrubbed...
Name: last3words.tmMacro
Type: application/octet-stream
Size: 835 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20070619/f84b9874/attachment.tmMacro>


More information about the textmate mailing list