I very commonly want to insert a number when using multiple selections. Many times, I'd like that number to increase between selections.

For example, I have 3 lines which I'd like to number:First LineSecond LineThird Line

I'd like to add a numbering in front of each, to get:1) First Line2) Second Line3) Third Line

So my question is, after multi-selecting the three lines, how can I add a number in front of each?And how do I control the details of the numbers? (i.e., the starting number, the amount of increase between the numbers, etc.).

Most editors have some kind of way of doing this when in "column-select" mode, I think that Sublime should have something even better because of the unique way it works with multiple selections.

Well, you don't need to select all 3 lines. Just use ctrl+alt+ up or down to select up and down. But, if you do select multiple lines, just hit ctrl+shift+l and it'll break your selection up into multiple lines. Then hit home/end and you can type. Ctrl+click will allow you to select multiple points as well.

Once you have multiple selections going though, you can do whatever you want in there. Type, navigate w/ keys like up, down, left, right, home, end, page up, page down, whatever you want.

Don't think he has a problem with multiple selections. I find myself running into similar problems but it doesn't really have a clear answer. It's most likely best suited to be tackled by a plugin. Bind a popup that takes a starting number and step and have it insert the proper numbers.

From what I understand he wants to have a few selections and he wants to add an incrementing number in each. For example if you have 3 selections there is no easy to add a 1 at the beginning of the first, 2 at the beginning of the second, etc.. If you hit 1 there's going to be a 1 at the beginning of every selection.

I decided to finally mess around with plugins and I made one that does this. It feels really ugly though. I don't have any Python experience so this is just what I pieced together while quickly skipping through the Python docs. I was wondering if anyone with more experienced could answer a few questions about it for me.

The first issue I had was passing integers as arguments to commands. I'm assuming commands can only take strings for some reason? That then led to the really ugly typecasting I ended up having to do. Is there a better way of doing what I did? (I hope there is :s)

Secondly, is there a better way to pass reference to the view the command was called on? I just stored it in the class and that seemed to work, but I was thinking there might be a better way of doing this?

If there's anything else that can be done cleaner please say so. My first time ever messing with Python and Sublime plugins so I'd like to start right. Thanks.

Oh and if anyone wants to mess with this plugin, bind insertNumbers to a key, it will open an input box at the bottom of the screen. The first number is the number to start with, and the second number is the step. For example, 1 1 will result in 1, 2, 3, 4.., 1 2 will result in 1, 3, 5, 7.., etc..

I was actually planning on creating my own plugin to add this functionality, but I didn't know if there was something already available.

@Anomareh - from a first glance, it looks good. I'm not on my dev computer so I don't even have Sublime here, I'll check it out when I get.

Here's the thinking I had for the plugin:I'd like an input panel, like you have, but which lets you enter lots of different types of input.One thing for example, should be a range (e.g. 0-5, etc.).One other input type would be a comma-separater list ("blue, green, brown"). This would make sense when you've got multiple selections which you don't want to break up, but do want to input something else.

I'll probably write this plugin sometime next week.Does anyone have any other good ideas for what kinds of input it should accept?

Really? There isn't a cleaner solution to the type casting? I can't imagine it's something Python, but why are so many commands restricted to strings? Just being able to use integers would make it a lot cleaner.

Most of the time I'm just editing something or prefixing / suffixing something so what I made pretty much covers anything I'd ever need. The other situations where you need to paste words is already in Sublime enough for me with column pasting. When I need to paste a column of words it's usually in a case where I'm copying variable names or something of the like. You can just make a selection of each word and it will paste into a column just fine.