Tuesday, November 1, 2011

Re: replacing all characters in the current line?

On 2011-11-02, Jose Caballero wrote:
> Hi,
>
> this happened to me today. I had a line like this one
> ===================
> and I wanted to replace all characters by '-', so I could have something like
> --------------------
>
> I thought I could do it by combining 'g' and 'r' as I understood 'g' is good to
> repeat the same command over all chars in a line (like guu or gUU).
> However, I was not able to make it work.
> I ended up doing something like :.s/=/-/g
>
> Is not really possible to replace all chars in the current line with a
> combination of 'g' and 'r' commands?

Using g,

:s/./-/g

Using r,

0v$r-

Or did you mean something else?

Regards,
Gary

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