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

Increment Selection

by yulanggong ST2/ST3 Trending

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

Details

  • 2017.09.19.10.21.01
  • github.​com
  • github.​com
  • 4 days ago
  • 2 hours ago
  • 5 years ago

Installs

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

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