ExpandRegion
Like “Expand Selection to Scope”. But better!
Details
Installs
- Total 13K
- Win 6K
- Mac 5K
- Linux 2K
Dec 30 | Dec 29 | Dec 28 | Dec 27 | Dec 26 | Dec 25 | Dec 24 | Dec 23 | 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 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 2 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 3 | 0 | 1 | 3 | 0 | 0 |
Mac | 0 | 0 | 0 | 1 | 0 | 1 | 2 | 0 | 2 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 2 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 2 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
Readme
- Source
- raw.githubusercontent.com
ExpandRegion for Sublime Text
Like “Expand Selection to Scope”. But better!
ExpandRegion works a bit like the build in “Expand Selection to Scope”, however it does not depend on Scopes (Scopes are used by ST to “understand” code, i.e. for syntax highlighting). Therefore selection expansion can be more granular and customizable.
It works similar to ExpandRegion for Emacs and “Structural Selection” (Control-W) in the JetBrains IDE's (i.e. IntelliJ IDEA).
Prereleases
Pre-releases help us to test new features and improve the stability of releases. You can benefit the newest features and help us testing them. Just open Preferences > Package Settings > Package Control > Settings - User and insert at a reasonable (correct JSON syntax) position:
"install_prereleases": ["ExpandRegion"],
If you also use pre-releases of other packages just add them comma separated into the list.
Example
JavaScript (should also work for other c'ish languages like Java).
- Expand selection to word
- Expand selection to quotes (content only)
- Expand selection to quotes (with quotes)
- Expand selection to square braces
- Expand selection to expression
- Expand selection to content of braces (all arguments in this case)
- Expand selection to line
- Expand selection to function body (w/o curly brace)
- Expand selection to function body (with curly brace)
and so on…
Python
Behaves similar to JavaScript, but also depends on indentation:
- Expand selection to word
- Expand selection to parentheses (content only)
- Expand selection to parentheses (with parentheses)
- Expand selection to function call
- Expand selection to line (w/o indent)
- Expand selection to indentation
- Expand selection to block start before indentation
- Expand selection to indentation
- Expand selection to block start before indentation
- Expand selection to indentation
- Expand selection to block start before indentation
and so on…
HTML
- Expand selection to word
- Expand selection to quotes (content only)
- Expand selection to quotes (with quotes)
- Expand selection to complete self closing tag
- Expand selection to parent node content
- Expand selection to complete node
- Expand selection to parent node content
and so on…
LaTeX (thx r-stein)
- Expand selection to word
- Expand selection to command
- Expand selection to command arguments
- Expand selection to brackets (content only)
- Expand selection to brackets (with brackets)
- Expand selection to surrounding command
- Expand selection to surrounding environment (content only)
- Expand selection to surrounding environment (whole)
- Expand selection to surrounding environment (content only)
- Expand selection to surrounding environment (whole)
and so on…
Installing
With the Package Control plugin: The easiest way to install ExpandRegion is through Package Control, which can be found at this site: http://wbond.net/sublime_packages/package_control
Once you install Package Control, restart ST and bring up the Command Palette (Command+Shift+P
on OS X, Control+Shift+P
on Linux/Windows). Select “Package Control: Install Package”, wait while Package Control fetches the latest package list, then select ExpandRegion when the list appears. The advantage of using this method is that Package Control will automatically keep ExpandRegion up to date with the latest version.
Without Git: Download the latest source from GitHub and copy the ExpandRegion folder to your Sublime Text “Packages” directory.
With Git: Clone the repository in your Sublime Text “Packages” directory:
git clone https://github.com/aronwoost/sublime-expand-region.git ExpandRegion
The “Packages” directory is located at:
OS X:
~/Library/Application Support/Sublime Text 2/Packages/
Linux:
~/.config/sublime-text-2/Packages/
Windows:
%APPDATA%/Sublime Text 2/Packages/
Using
- Set a shortcut. Open “Key Bindings - User” and add to following line: “ js { "keys”: [“super+shift+space”], “command”: “expand_region” }, { “keys”: [“super+u”], “command”: “expand_region”, “args”: {“undo”: true}, “context”: [{ “key”: “expand_region_soft_undo” }] },
Note: third party plugins can not properly hook into the history. So soft-undo in basically only a undo expand selection. Soft-redo will not work.
## Develop
## Background
This plugin is inspired by the amazing [expand-region for Emacs](https://github.com/magnars/expand-region.el).
Here a video showing this feature (in Emacs):
[![](http://img.youtube.com/vi/_RvHz3vJ3kA/0.jpg)](http://www.youtube.com/watch?v=_RvHz3vJ3kA?feature=player_embedded&v=M)
Read more:
[Extend Selection by Semantic Unit](http://ergoemacs.org/emacs/syntax_tree_walk.html)
## License
MIT