[TxMt] Modifying word selection
James Andrews
james.andrews at re-cog.com
Tue Apr 11 12:24:24 UTC 2006
>> [...] I'm often wanting to copy, change or set search selection,
>> part of a variable name which doesn't include a dash, underscore,
>> etc., though most of the time I do want it to include those
>> elements as part of a single word.
>
> This is very hard to follow. Could you give an example? And is this
> run-time toggling of the word characters based on basically your
> mood or could it be boiled down to having different word characters
> for different scopes (planned) or have the unit you want to work on
> be something which is already defined by the syntax highlighting
> (as there are also some plans of making that reachable from
> commands/snippets)?
>
Alan, firstly apologies for the lack of clarity, and the delay in
replying. The idea isn't for it to be based on my mood (:-P) and
neither is it based on scopes or syntax highlighting, unless I
misunderstand your meaning.
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.
Using this facility with Cmd-e to 'search in project' allows you to
rapidly find related symbols that have something in common without
making the scope totally specific to a single entity. i.e. quickly
finding a family of variables or commands that share a common element
in their name.
So, in other words, it's about ad-hoc selections of text where a lot
of the time I want the whole thing but at other times I want a part
of it. Usually the difference between the whole of the item and a
part is related to these extra word characters (although camel-case
is another mechanism for creating a logical element within a
contiguous set of characters.)
Ideally, I'd like to be able to do this operation with either
keyboard or mouse selection methods, depending on the circumstance.
Having different word characters for different scopes is great is but
I'm not sure if that this would answer my request (though it might
add to its relevance) which is to be able to (optionally) select word
elements.
I hope this explains my meaning. I would be interested to know if it
would be considered generally useful. Personally I would use it all
the time, but my usage pattern may be different to the majority of
people. If you want me to be more specific, I can give some real
world examples, but thought my post was already long enough!
On another (related) topic, I really love the new Ctrl-Opt-B.
James
More information about the textmate
mailing list