[TxMt] move to end of 'scope'

Allan Odgaard throw-away-2 at macromates.com
Thu Mar 27 02:38:20 UTC 2008


On 20 Mar 2008, at 07:00, Sean Allen wrote:

> lets says i have
>
> <img src="something" width="10" height="15>
>
> and i have the caret somewhere around src
>
> is there a way to move to either right before or after the closing >

Not by default, no. But if you need this a lot, do something like:

    Start Macro Recording
    Search forward for >
    Stop Macro Recording

Now save this macro, and here is the nice part, give it an easy key  
equivalent like e.g. ⌃→. Then give it a scope selector like  
‘meta.tag’. This will then only have the key run the macro when  
caret is inside tags. I.e. the idea here is that you can pick a key  
sequence with good mnemonic, since it will only be for this limited  
scope.

You can find more info about macros and scope selectors in the manual.

> or when you get auto "" and it drops the caret in the middle,
> is there a way to jump to right outside the quote?

Well, pressing " again will overtype it, pressing → will move past  
it, so will ⌃F. You need a fourth option? :)

There are however more options, for example ⌘↩ is a macro for  
“move to end of line and press return”, so say you type: ‘<h1  
id="bar’ you will actually have: ‘<h1 id="bar‸">’ (‸ marking  
the caret). Rather than “step over” the two end characters, simply  
press ⌘↩ to skip both _and_ advance to the next line.

A variant of ⌘↩ is ⇧⌘↩ which also inserts a line-terminator,  
in C and related languages, that would be a semi-colon, but in prose  
it is a period.




More information about the textmate mailing list