Home Ask Login Register

Developers Planet

Your answer is one click away!

getorix February 2016

Notepad++/Vim Incremental Insert

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 February 2016

It should be an easy task for vim:



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

Post Status

Asked in February 2016
Viewed 3,763 times
Voted 9
Answered 1 times


Leave an answer

Quote of the day: live life