In Sublime Text, I know Command + D selects the current word and the next occurrence of it when you press the shortcut again.

What I'm searching for is a Sublime Text 3 plugin that assigns the following behavior to a keyboard shortcut:

  1. First shortcut press, selects the current word (Exactly as Command + D does)
  2. Second shortcut press, expands the selection to also include the next word (whatever that word is)

In short, I'm trying to simplify the following:

  • Command + D (To select current word)
  • Alt + Shift + Right arrow to expand selection so it includes the next word
  1. Go to Preferences → Key Bindings ‐ User.
  2. Add below lines to just opened file between [ and ].
    { "keys": ["f1"], "command": "move", "args": {"by": "subword_ends", "forward": true, "extend": true}},
    { "keys": ["f1"], "command": "find_under_expand", "context":
            { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true },
  3. Change f1 to any other shortcut key, if you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.