[TxMt] Modifying word selection
Charilaos Skiadas
cskiadas at uchicago.edu
Tue Apr 11 12:46:36 UTC 2006
On Apr 11, 2006, at 7:24 AM, James Andrews wrote:
> In quite a number of development situations (Rails, CSS, PHP, XSLT,
> etc.), commands, variables and other elements are often written in
> the form xxx-yyy or xxx_yyy_zzz. I often find myself dealing with
> related entities of the form xxxxxxxxx-aaaaaa and xxxxxxxxx-bbb
> where I just want to select the xxxxxxxxx or aaaaaa portion quickly
> and easily to either replace it, copy it or enter it into the
> search buffer.
>
> Other uses relate to elements such as variables (with @ or $ at the
> start) or css colour codes (such as #f33456) where you want to
> select everything except the special character in order to copy or
> replace it. For example Photoshop doesn't include the # if you copy
> a colour, so replacing an existing colour in a CSS file is slightly
> more fiddly than I'd like it to be, and I find that when I'm
> working on a design I have to do this often.
This sounds like it could be easily accomplished by a macro recording
an appropriate regexp search. If you have the standard word selection
include the underscores etc, you could create a macro, bound to your
favorite keypress, which does a backward regexp search for a
"(sequence of letters, preceded by a nonletter and followed by a
nonletter) or (a sequence of numbers, preceded by a nonnumber and
followed by a nonnumber)". So maybe something like:
((?<![a-zA-Z])[a-zA-Z]+(?![a-zA-Z]))|((?<![0-9])[0-9]+(?![0-9]))
Of course you can adjust it to your liking. Once Allan also plans to
allow mouse gestures as triggers for bundle items, you will be able
to even trigger this by some mouse gesture. Unless I've misunderstood
what you are trying to do.
Haris
More information about the textmate
mailing list