[TxMt] Select between quotes

Allan Odgaard throw-away-1 at macromates.com
Thu Nov 17 18:14:40 UTC 2005


On 17/11/2005, at 19:01, Warren Parsons wrote:

> This isn't quite what I'm talking about.
>
> I want to be able to place my cursor inside *any* given quote pair,  
> hit a keyboard shortcut, and have everything between the quotes  
> selected. I just gave "href" as an example.

There's no such thing as native functionality -- I plan to make the  
“select to enclosing braces” a little smarter, but for now what you  
can do is:

  Automation / Start Macro Recording
  Find (no options) previous: "       (this selects the " to the left  
of the caret)
  Press arrow left                    (to move caret in front of it)
  Find (enable regexp) next: ".*?"    (this should select the entire  
string)
  Automation / Stop Macro Recording

Now select Automation / Save Scratch Macro and give it whatever key  
you like. In addition you can provide a scope, which is like a CSS  
selector for where this macro should work, so e.g. if you give it  
scope “string” you could bind it to cmd-shift B, and inside strings,  
TextMate will use your macro to select strings, but outside, you'll  
get the standard “Select Enclosing Brackets” function (which for HTML  
also selects <tags>).





More information about the textmate mailing list