azio
azio

Reputation: 585

Select additional occurrences of a word in TextMate 2

How can I select additional occurrences of a word in TextMate 2? I do this in Sublime Text 2/3 by pressing Ctrl+D (Windows, Linux) or Cmd+D (macOS).

Upvotes: 9

Views: 4304

Answers (2)

Michael Sheets
Michael Sheets

Reputation: 553

Updated answer

As indicated below, ⌃W (Select Word) is the shortcut in the current build.

Previous answer

Taken from the release notes for r9302:


Add two new action methods:

findNextAndModifySelection:
findPreviousAndModifySelection:

These find the next/previous occurrence of what’s on the find clipboard and selects that, but preserves the existing selection. One could e.g. add this to Keybindings.dict:

"@d" = ( "copySelectionToFindPboard:", "findNextAndModifySelection:" );

This binding will likely be default in an upcoming build, but bound to ⌃W (Select Word) and scoped to dyn.selection (so only when a word is already selected).


You can learn more about key binding files at:

Upvotes: 16

tim
tim

Reputation: 3608

There are two macros here that do what you want.

They are hooked to ^-W and shift-^-W and have a dyn.selection context.

This lets ^-W select the current word as usual, but once a selection exists, it will extend the selection (using TM2's nifty ability to generate multiple selections).

I imagine allan will soon add something like this or better by default, but 'til then, this a a great feature!

Upvotes: 3

Related Questions