Vi commenting out

Jorge Almeida jalmeida
Tue Oct 17 00:22:56 PDT 2006


On Mon, 16 Oct 2006, Michael Hipp wrote:

> Is there any simple trick for having vi comment out a whole range of lines by
> placing a '#' in front of them? The manual method of i # ESC j is rather
> tedious if there is a big section to be done.
>
Are you talking about the real vintage vi, as opposed to vim?

With vim, I select the range in visual mode and just do :s/^/#/
Actually, I use a visual mode macro to do it (Ctrl-X Ctrl-D to comment
and Ctrl-X Ctrl-U to uncomment). It's as easy as I could wish.
(Don't know a thing about vi...)
-- 
Jorge Almeida



More information about the Linux-users mailing list