Expand Selection to Whitespace
Expand the selection to the whitespace that surrounds the cursor(s) or selection(s) in Sublime Text
Details
Installs
- Total 3K
- Win 2K
- Mac 1K
- Linux 590
Dec 22 | Dec 21 | Dec 20 | Dec 19 | Dec 18 | Dec 17 | Dec 16 | Dec 15 | Dec 14 | Dec 13 | Dec 12 | Dec 11 | Dec 10 | Dec 9 | Dec 8 | Dec 7 | Dec 6 | Dec 5 | Dec 4 | Dec 3 | Dec 2 | Dec 1 | Nov 30 | Nov 29 | Nov 28 | Nov 27 | Nov 26 | Nov 25 | Nov 24 | Nov 23 | Nov 22 | Nov 21 | Nov 20 | Nov 19 | Nov 18 | Nov 17 | Nov 16 | Nov 15 | Nov 14 | Nov 13 | Nov 12 | Nov 11 | Nov 10 | Nov 9 | Nov 8 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 |
Mac | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Expand Selection to Whitespace
A plugin that helps you go faster with Sublime Text
Expand the selection to touch up against the closest space, tab, newline, or Unicode spacing character surrounding the cursor(s) or selection(s).
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 space before and after where you are. Now you can do that.
Bound by default to Ctrl+Shift+X on Windows and Linux, and ⇧⌘X on Mac. Works well with Sublime Text 4, 3 and 2.
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.zstd
- URLs: https://github.com/bits/ExpandSelectionToWhitespace-SublimeText
- Some coding styles: self.expand_region_to_whitespace(region)
- 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 do your bidding in the Selection menu, the Command Palette, and via key binding.
Use any key binding
The plugin supplies the expand_selection_to_whitespace
command, which you can bind to your preferred keyboard shortcut in your Preferences → Key Bindings – User
file by adding something like:
{ "keys": ["ctrl+shift+x"], "command": "expand_selection_to_whitespace" }
Installation
Install using Package Control (recommended)
In Sublime Text 2, 3, or 4 with the Package Control plugin installed:
- Bring up the Command Palette with Control+Shift+P on Windows and Linux or ⇧⌘P on Mac.
- Select “Package Control: Install Package”, and wait while Package Control fetches the latest package list.
- Select “Expand Selection to Whitespace” when the list appears.
When you use the Package Control plugin to install a plugin, it is automatically updated when a new version is available.
Install manually by cloning the git repository
Clone the repository right into your Sublime Text “Packages” directory. Find yours with Sublime Text → Preferences → Browse Packages
. Change to that directory and clone:
git clone https://github.com/bits/ExpandSelectionToWhitespace-SublimeText.git "Expand Selection To Whitespace"
To later update to the latest:,git pull origin master
from within the “Packages/Expand Selection To Whitespace” directory.
Install manually from a zip archive
For Sublime Text 3 and 4
- Download the latest zip archive
- Rename the .zip file to
Expand Selection to Whitespace.sublime-package
- Move it into your Sublime Text “Installed Packages” directory. Find yours by going to
Sublime Text → Preferences → Browse Packages
, and then going up one directory level to find the “Installed Packages” directory.
Repeat this procedure in the future to update to the latest version.
For Sublime Text 2 (ST2)
- Download the latest zip archive
- Unzip
- Rename the resulting directory to
Expand Selection to Whitespace
- Move the directory into your Sublime Text “Packages” directory. Find yours with
Sublime Text → Preferences → Browse Packages
Repeat this procedure in the future to update to the latest version.
Also known as
This plugin was written after trying a few web searches for a package to do this, but finding that there wasn't anything like it available. With the hope of helping anyone else following the same search trail find their way:
- Expand selection to spaces in Sublime Text
- Select to word boundaries
- Grow selection to whitespace
- Sublime Text selection expansion
- Extend selection to first and last non-whitespace character around cursor
- Select up to surrounding spacing characters
- Select until space
- Select like Vim's big WORD movement in visual mode
Contact
If there are any problems or you have a suggestion, please open an issue, and I'll receive a notification. You may also want to see any previously reported issues and suggestions on the Expand Selection to Whitespace repo on github
MIT License
Copyright © 2013 Paul Sarena
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.