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

Increment Selection

by yulanggong ALL

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

Details

  • 2017.09.19.10.21.01
  • github.​com
  • github.​com
  • 3 years ago
  • 3 hours ago
  • 8 years ago

Installs

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

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