Select words like ST's ⌘D


I was missing the ⌘D functionality from ST where I could add consecutive appearances of the word under the cursor as new selections, so I made a package:

^⌥N is mapped to select first the word under the cursor unless something is already selected, and after that to select more occurrences. It wraps around when reaching the end of the file.

There is also a “select all occurrences” command, but I can’t get that to work. The callback to TextBuffer.scan always only gets called once for some reason… if someone could shed light on that, that’d be brilliant.

Select next (cmd-d) doesn't wrap past the end of a file

Duh, cracked it, I just wasn’t setting the global flag on my RegExp, which caused the iteration to stop after the first match, naturally. Just pushed 0.2.0 which has this feature, mapped to ^⌥A.


Odd, Cmd ⌘D works for me already, once a word is selected…


Lulz, just only now found it myself :smiley: well, that was a fun exercise in futility.


The built-in Cmd ⌘D doesn’t wrap at the end of the file … so it may not be completely wasted effort. Perhaps you can submit a pull request for the find-and-replace package?


The package page ( is 404ing. Has this package been removed for some reason?


Yeah, I pulled it since it was duplicating core stuff, but I’m gonna see if I can’t make a PR against find-and-replace that would get the wrapping behavior in there.