Vi commenting out

Michael Hipp Michael
Tue Oct 17 06:17:54 PDT 2006


Jorge Almeida wrote:
> 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...)

I haven't been around long enough to even ponder the fact that vi != vim 
as every system I've touched always comes with vim but calls it vi.

Thanks for your solution, and the macros. Looks great.

Michael



More information about the Linux-users mailing list