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

Increment Selection

by yulanggong ST2/ST3

Add a number to each selection in Sublime Text, incremented once per selection

Details

  • 2017.09.19.10.21.01
  • github.​com
  • github.​com
  • 2 months ago
  • 1 hour ago
  • 5 years ago

Installs

  • Total 17K
  • Win 8K
  • OS X 6K
  • Linux 3K
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 Oct 7 Oct 6
Windows 0 8 8 13 28 15 15 16 7 6 14 31 27 23 20 5 8 16 21 18 10 17 11 7 31 19 15 19 23 8 7 24 19 12 15 23 6 6 14 17 16 26 16 9 4 16
OS X 0 4 2 12 13 9 13 5 0 7 8 13 8 14 6 4 4 12 9 12 8 18 6 4 4 7 10 13 10 5 2 13 4 10 15 12 1 2 11 4 5 10 10 2 3 7
Linux 0 2 2 20 3 3 8 7 1 0 5 2 9 6 4 1 4 6 4 9 6 5 4 1 9 7 2 8 6 3 2 1 8 8 8 3 2 1 7 5 2 6 6 2 0 5

Readme

Source
raw.​githubusercontent.​com

Increment Selection

Add a number to each selection in Sublime Text, incremented once per selection. You may also insert the number of line containing the selection by using the '#' symbol.

This plugin is based on Riccardo Marotti's answer on StackOverflow. The default hotkey is ctrl alt i or cmd ctrl i.

Usage

Place the cursors where you need:

step 1

Insert the number the counter should start from (in this case 1):

step 2

Select the number you typed (shift <—):

step 3

Type the shortcut:

step 4

Examples

Tips: [] stands for a selection, | stands for a caret.

[1] text [1] text [1] -> 1| text 2| text 3|

[a] text [a] text [a] -> a| text b| text c|

[A] text [A] text [A] -> A| text B| text C|

[01] text [01] text [01] -> 01| text 02| text 03|

[05,2] text [05,2] text [05,2] -> 05| text 07| text 09|

[5,-1] text [5,-1] text [5,-1] -> 5| text 4| text 3|

[a,3] text [a,3] text [a,3] -> a| text d| text g|

Increment follows the difference between the first and second element:

[10] text [9] text [1] -> 10| text 9| text 8|   

[a] text [c] text [a] -> a| text c| text e|

Generate line numbers:

[#] line -> 1| line
[#] line -> 2| line
[#] line -> 3| line
[#] line -> 4| line
[#] line -> 5| line