FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 09-29-2011, 04:31 PM
lina
 
Default a quick question: how to add comments for several lines at the same time

Hi,

When I use vim (how can I add comments for several lines at the same time, not one by one)
add #

are there some trick? (without using some package:http://www.vim.org/scripts/script.php?script_id=1528* )


Thanks ahead,
--
Best Regards,

lina
 
Old 09-29-2011, 04:56 PM
lina
 
Default a quick question: how to add comments for several lines at the same time

On Fri, Sep 30, 2011 at 12:52 AM, 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

How did you set a mark "a"?

sometimes some row at the beginning you might not plan to comment, it's not some pre-thought, it might need comment during the testing procedure,


Thanks,
*
cursor to the last row I want commented and type:



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



This assumes you want the comment the entire line.



John





--

To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org

with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

Archive: http://lists.debian.org/20110929165213.GB7671@infotech





--
Best Regards,

lina
 
Old 09-29-2011, 04:57 PM
Chris Brennan
 
Default 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 rememberexactly 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)*------------------------------------------------------------------------*
 
Old 09-30-2011, 11:10 AM
Jochen Spieker
 
Default a quick question: how to add comments for several lines at the same time

lina:
>
> When I use vim (how can I add comments for several lines at the same time,
> not one by one)
> add #

There's probably a more efficient way to do this, but I always go to the
start of the first/last line, press Ctrl-v (enters visual block mode),
mark the lines I want to comment, then press 'I', make my changes and
then exit visual mode again by pressing Esc

J.
--
After the millenium I will shoot to kill.
[Agree] [Disagree]
<http://www.slowlydownward.com/NODATA/data_enter2.html>
 

Thread Tools




All times are GMT. The time now is 06:47 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org