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 years ago
  • 2 hours ago
  • 6 years ago

Installs

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