[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a quick question: how to add comments for several lines at the same time



On Thu, Sep 29, 2011 at 12:52 PM, John L. Cunningham <djohngo@gmail.com> wrote:
On Fri, Sep 30, 2011 at 12:31:00AM +0800, lina wrote:
> Hi,
>
> When I use vim (how can I add comments for several lines at the same time, not
> one by one)
> add #

I set a mark "a" at the first row that I want to comment, then move the
cursor to the last row I want commented and type:

:'a,.s/^/# /g

You can do something similar in visual mode as well, I don't remember
exactly how though.

> --
> Chris Brennan
> A: Yes.
> >Q: Are you sure?
> >>A: Because it reverses the logical flow of conversation.
> >>>Q: Why is top posting frowned upon?
> http://xkcd.com/84/ | http://xkcd.com/149/ | http://xkcd.com/549/
> GPG: D5B20C0C (6741 8EE4 6C7D 11FB 8DA8  9E4A EECD 9A84 D5B2 0C0C) 
------------------------------------------------------------------------ 

Reply to: