Sublime Forum

InsertNums - Sequential alphanumeric insertion

#1

Hi all,

Back in 2011, I wrote my first Sublime Text plugin, InsertNums. Today I’m finally releasing a new version. It’s somewhat a mash up between the original InsertNums and IncrementSelection, as now you can increment through letters as well as numbers.

Ctrl+Alt+N will bring up the input panel, then just use 1 1 0 for numbers (where the first 1 is your starting number) or a 1 0 where a is your starting letter.

One of the great side effects of introducing alpha sequences is that you can generate seemingly (but definitely not) random sequences. For instance, using a 12345 0 will generate the following across three selections:

a
rfv
ajmq

All that’s happening there is that the next letter in the sequence is shunted across by the step amount.

Anyway, you can find InsertNums on GitHub.

James

0 Likes

Multiple cursor - is possible this?
#2

Hi, it would be nice to have such plugin form me, but it is not working in ST2 for me.
It promts me for two numbers and after any combination onlu one number is entered in text.

Any idea? thank you.

0 Likes

#3

[quote=“rolandba”]Hi, it would be nice to have such plugin form me, but it is not working in ST2 for me.
It promts me for two numbers and after any combination onlu one number is entered in text.

Any idea? thank you.[/quote]

How many selections do you have? It’ll only put one number per selection.

0 Likes

#4

[quote=“rolandba”]Hi, it would be nice to have such plugin form me, but it is not working in ST2 for me.
It promts me for two numbers and after any combination onlu one number is entered in text.

Any idea? thank you.[/quote]

It takes two numbers. First is the starting number (default 1) second is the increment number, so if you start from 1 and increment 2, you’ll get 1 3 5 7 etc etc

0 Likes

#5

@jbrooksuk: I found this very useful and submitted this to Sublime Package Control. It is available to install now under the name InsertNums. Repo is at bitbucket.org/markstahler/insert-nums

0 Likes

#6

@kramed Thank you for setting up the package. I noticed that the description on the bitbucket page says the default binding is Control + Shift + N, but it seems the actual binding is Control + Alt + N. Could the description be fixed?

Thanks!
Mike

0 Likes

#7

Good catch. Fixed.

[quote=“mhenry07”]@kramed Thank you for setting up the package. I noticed that the description on the bitbucket page says the default binding is Control + Shift + N, but it seems the actual binding is Control + Alt + N. Could the description be fixed?

Thanks!
Mike[/quote]

0 Likes

#8

Yay! First real update in two years. It’s finally on GitHub and compatible with ST3 and should be ST2 too.

0 Likes

#9

There have been a few updates over the last couple of weeks:

  • Hex support, using the x1 1 0 pattern.

  • Extra hex support
    (hex with 0x prefixed) which allows bit shifting. 0x1 << 2

Both hex support will be merged later on, so you can perform bitwise operations on just x1 etc. As soon as I know it’s working, that’s why it’s currently undocumented.

Get it here. Or on Package Control under “Insert Sequences”.

0 Likes

#10

This morning I updated InsertNums to add a new key binding (same as before, but add Shift) to not automatically insert the sequence. I don’t know why you’d want to do this, but it was requested and so someone has a need for it.

0 Likes

#11
  • Just merged a fix for ST2 on OSX.
0 Likes

#12

I just pushed a complete rewrite of the code as 2.0.0.

New features include:

  • An entirely new format syntax has been introduced that includes all previous
    features and an infinite amount of new ones.
    This essentially simplified the syntax for easy tasks and added options for
    complex tasks too.

  • Python expression functionality has been added, modify numbers in any way
    you please (e.g. binary bitflags).

  • An expression mode has been added which allows you modify the current value
    of a selection.

  • The panel now previews your inputs live and removes them accordingly when
    you abort.

You should totally check out the new examples on github.com/jbrooksuk/InsertNums … /README.md

0 Likes