Thursday, June 24, 2010

Re: pasting a block multiple times to the end of lines after a visual select (Ctrl+v)

On Jun 24, 2:44 pm, Dominique Pellé <dominique.pe...@gmail.com> wrote:
> Rahul wrote:
> > I have a file that looks like below. Frequently I encounter this
> > scenario where all the shorter lines need to be padded with the zero
> > blocks on the right hand side. I can visual select with a Ctrl+v on
> > the segment
>
> > ;     0;      0;      0
>

> You can select a visual rectangular block (with CTRL-V)
> then press  A   then type the text which will be added at the
> end of visual block, finally press  Esc  and added text will
> be repeated for all lines in visual block.
>
> In your example, you could also use something like this:
>
> :%s/^\d*;\s*$/&     0;      0;      0
>
Thanks Dominique! That works.

--
Rahul

--
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:

Post a Comment