> I have a defination in a program: integer value[0] ,
> now I wanna get more lines as number order like this:
>
> integer value[0];
> integer value[1];
> ...
> ...
> integer value[31];
> ....
> even more...
>
> I don't wanna copy then modify .it's too tired. how can make it easy~!
For the simple case you describe (one number to increment on the
line), you can do something like
:nnoremap <f4> p<c-a>yy
You can copy the first line with "yy", and then use <f4> to do
the paste+increment+reyank to get the incremented line into the
scratch register. If you want to repeat it, you can record that
sequence (the "p<c-a>yy" where <c-a> is control+A) into a macro
if you want to execute it multiple times by prefixing with a count.
You can also do it post-facto with something like
:'<,'>s/integer value\s*\[\zs[^\]]*/\=line('.') - line("'<")
which will auto-number all the items in a visually selected range.
-tim
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---