575 wrote:
> hi.
>
>   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~!
>
>  thanks~!
>   

It's simple with a macro.

Type your first line:

        integer value[0];

Position your cursor on the line.  Now, in command mode, press qx (q =
start macro, x= name of macro).

Now we will record a sequence of commands to make another line with an
incremented number:

yyp (copy line and paste)
ctrl-x (increase the first number found - in this case, there is only one)
q (end recording the macro)

You can now repeat the macro by executing @x in command mode (@ = replay
macro).  To execute the last macro you have run, use @@.  Like most Vim
commands, the @ command can be repeated an arbitrary amount of times. 

So if you want 20 increments to happen, execute 2...@x.

Hope that helps.

Check out:
    :help complex-repeat
    :help q

Regards

-- 

[ Albie Janse van Rensburg ~ http://morph.telspace.co.za ]

Laugh, and the world ignores you.  Crying doesn't help either.


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to