On 11/02/2011 12:43 AM, Gary Johnson wrote:
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



In this particular case (no leading indent),
I think Vr- is the easiest command, much easier
than :s. Incidentally, I have a visual mode
mapping to select only the text in current line
and it's often very useful, and I'd use it in
this case if the line was indented.

 -ak

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

Reply via email to