0

I have a file that I'm writing where I need to insert incrementing numbers in two different places (Context & UConfig). I've tried using the column editor in Notepad++, but it also adds numbers in the middle of the other rows.

forw mte Context 0  
forw mte Config 1 0 0  
forw mte CellSelection 10000  [10]  
forw mte UConfig 1([100000000000000 2] [] [] []) [] [0]  
forw mte ConfigCapability [1] [100] [100]  
forw mte ConfigSelection 20000

I need to copy this selection 1000 times with Context going from 0-999 and UConfig going from 100000000000000-100000000000999.

Kent
  • 189,393
  • 32
  • 233
  • 301
getorix
  • 3
  • 4
  • I reopened question. Because it is not a duplicate of http://stackoverflow.com/questions/26178151/notepad-add-number-in-each-line. The solution in that answer won't solve OP's problem. the Notepad++'s Column-mode doesn't help on this Question. – Kent Feb 08 '16 at 20:05

1 Answers1

0

It should be an easy task for vim:

type:

qq?Conte<CR>6YGgpn<C-A>3jf0<C-A>q

then do 998@q

  • first step is record a macro <CR> and <C-A> means pressing Enter and Ctrl-A
  • 2nd step is to replay the macro 998 times
  • "what does the first line do exactly"? try by yourself from first ? till last <c-a> you will see how the text was modified

Following is a demo, to show add the text from 0 - 4 (after recording, press 3@q):

enter image description here

Kent
  • 189,393
  • 32
  • 233
  • 301
  • Thanks for the amazing response. It works great except when I have a number like 26280052223000 in UConfig. When i try to increment it, it turns into 63322353. I think this may be an issue with the number being read as octal or hex? – getorix Feb 08 '16 at 20:38
  • you can try change the `f0` into `f[l` – Kent Feb 08 '16 at 20:44
  • That didn't seem to help, I've also tried removing octal and hex from nrformats, but I'm still encountering that problem. – getorix Feb 09 '16 at 14:21
  • in a new buffer type `26280052223000`, then move your cursor on it, press `Ctrl-A` (normal mode), does it change into `26280052223001`? – Kent Feb 09 '16 at 15:16
  • Seems like nothing happens now... `Ctrl-A` still works in the original buffer where I'm seeing the error though. – getorix Feb 09 '16 at 16:43
  • Ignore that, when I do `Ctrl-A` in a new buffer it turns into 3442306073. I have no idea what's going on. – getorix Feb 09 '16 at 18:33