On 09/18/2011 08:47 AM, Harvey Li wrote:
Hello, Everybody,
How to generate auto increased number lines in vim?
For example,
a[0]
a[1]
a[2]
a[3]
......
One method of doing so would be:
ia[0]<Esc>qqyyp<C-a>q@q@q@q
That is:
i: go to insert mode
a[0]: type the first line
<Esc>: go to normal mode
qq: start recording a macro into register q
yy: yank the current line
p: paste the yanked line
<C-a>: increase the number
q: stop recording
@q: replay the macro, adding the second line
@q: replay the macro again, adding the third line
As an alternative to repeating @q a few times, you could also use 5@q to
repeat it 5 times for example
Hope this helps,
Jeroen
--
website: http://budts.be/ - twitter: @teranex
___________________________________
Registered Linux User #482240 - GetFirefox.com - ubuntu.com
--
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