ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Uber​Selection

by SublimeText ST2

Commands to extend the functionality of Sublime Text's multiselection.

Details

  • 2011.04.25.09.37.53
  • github.​com
  • github.​com
  • 14 years ago
  • 50 minutes ago
  • 13 years ago

Installs

  • Total 1K
  • Win 568
  • Mac 378
  • Linux 162
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 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8
Windows 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
Mac 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
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

Uberselection

Make complex selections and replace text in a buffer via textual commands. Inspired in Vim's line-oriented ex mode.

Getting Started

If you're running a full installation, simply doubleclick on the .sublime-package files. If you're running a portable installation, perform an installation by hand.

Usage

  1. Run from Sublime's console with view.run_command("uber_selection")
  2. Issue command as explained further below

Examples

10,20V/this/
Select lines containing this between lines 10 and 20 (inclusive).
.,.+20-V/this/
Select lines not containing this from the current line to 20 lines down from it.
%s/this/that/
Replace this with that in the whole file.

Four Ways of Issuing Commands

  1. <SUBLIME COMMAND>[ <ARG>]
  2. <LINE REF>[,<LINE REF>]
  3. <BUFFER COMMAND>[;<BUFFER COMMAND>]*
  4. <LINE REF><BUFFER COMMAND>[;<BUFFER COMMAND>]*

All tokens are explained in the following sections

Tokens

Sublime Commands

(Not all commands work.)

w [arg]
Save the active buffer. If you pass an arg to it, the Save As dialog will show up. At the moment, the passed arg is ignored.
wall
Save all opened buffers.
wq
Save the active buffer and exit.
ZZ
Save the active buffer and exit.
ls
Show list of opened views.
e
Show list of files in current directory.
q
Exit.
n
Next view.
N
Previous view.

Line References

Select lines or ranges of lines in the active view.

[1-9]+
Designates line by number.
.
Desigates the current line (first cursor in selection).
$
Designates the last line in the view.
%
Designates all lines in the view.
/what/
Looks forwards to find first line matching what or returns current line if none found.
?what?
Looks backwards to find first line matching what or returns current line if none found.

You can also specify offsets with [+-][1-9]+.

In order to designate a range, use two comma separated line references:

.+5,/end$/-3

Text Commands

Select lines and perform replacements in the view.

V/what/<flags>
Selects all lines containing what. Case insensitive by default. Use the flag c to make a case-sensitive search.
-V/what/<flags>
Same as above, but excludes the lines matching what.
s/what/with/
Replaces all instances of what with with. Case sensitive. The separator / can be substituted by any of: ! $ % & = / : ;

You can chain commands by separating them with a semicolon (;):

.+5,/end$/-3V/foo/;-V/bar/;s/foo/BOO!/