Sublime Text's "Expand Selection to Word" (first press of Ctrl+D / ⌘D) is a really fast way to select the word you're on. But sometimes you want more than the simple word, you want everything up to the spaces surrounding the cursor or selection. Now you can do that.
It turns out this is really handy
- Quickly lazy-select text — Select partway into the first and last words and hit the shortcut. This gives you much larger targets for the start and end of your selection, so you don't have to go slowly and precisely to get the pointer or cursor right at the tiny sweet spot. It's surprising what a difference this makes.
- Paths: /home/user/project/awesome ← Place the cursor anywhere in the path and get the whole thing with a keystroke
- Filenames: access_log-2099-12-31.tbz2
- URLs: https://github.com/bits/ExpandSelectionToWhitespace-SublimeText
- Some coding styles: self.expand_region_to_whitespace(region)
- When you made a selection, but missed the first few characters — grab them instead of repeating yourself
- Quickly selecting vertically aligned text or a column — Perform a narrow column selection (Ctrl+Alt+Up/Down on Windows/Linux, Ctrl+Shift+Up/Down on Mac) and widen each line's selection out to the whitespace with a flick of the fingers
You'll find Expand Selection to Whitespace ready to quicken your flow via Ctrl+Shift+X on Windows and Linux, and ⇧⌘X on Mac. It's also in the Selection menu and Command Palette.
Browse the repo at https://github.com/bits/ExpandSelectionToWhitespace-SublimeText for the code and installation / alternate key binding instructions, or jump right in with Package Control: Install Package → Expand Selection to Whitespace.