Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
369 views
in Technique[技术] by (71.8m points)

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

Is there a way to add insert a number that is incremented once per cursor in Sublime Text 2?

Example, with | as the cursor:

Lorem ipsum dolor sit amet, |
vehicula sed, mauris nam eget| 
neque a pede nullam, ducimus adipiscing, 
vestibulum pellentesque pellentesque laoreet faucibus.|

Desired result:

Lorem ipsum dolor sit amet, 1|
vehicula sed, mauris nam eget2| 
neque a pede nullam, ducimus adipiscing, 
vestibulum pellentesque pellentesque laoreet faucibus.3|

Does this functionality exist natively, or is there a plugin providing it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I recommend the plugin Text Pastry. The Number Sequence command is the one you need.

I prefer to use the Insert Nums command:

Text Pastry has a build in support for the Insert Nums syntax by providing three numbers separated by one space:

N M P

N: the start index.

M represents the step size which will be added to the index for each selection.

P must be > 0 and will be used to pad the index with leading zeroes.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...