Sunday, September 18, 2011

Re: How to generate auto increased number lines

Harvey Li <lihuawei78@gmail.com> [11-09-18 09:28]:
> Hello, Everybody,
> How to generate auto increased number lines in vim?
> For example,
> a[0]
> a[1]
> a[2]
> a[3]
> ......
> Thanks!
>
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Hi Harvey,

you can do this conveniently with a macro definition.

First type the first line by hand:

a[0]

then start defining a macro by entering

ESC q q

then do the editing work

yyp<ctrl-a>

end your macro definition by entering

q

Now position your cursor where the '*' (dont type this) is:

a[0]
a[1] *

To execute the macro type

<AltGr-q>

. The result is

a[0]
a[1]
a[2]

. If you want to execute it n times preceed AltGr-q by the
number n of executions you want to be executed.

HTH!

Best regards and have a nice weekend!
mcc

--
Unix,vim and a IBM model M - what does it need more?

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: