[ubuntu-uk] Advanced vi/vim command - commenting out a large section

Sean Miller sean at seanmiller.net
Wed Aug 20 12:52:45 BST 2008


> DarkOtter wrote:
>>> It's a little bit hacky, but the way I do that is to do a substitute with the
>>> 'start of line' token in the regexp. That way you can use a standard vim range
>>> e.g. 1,10 to do lines 1 to 11

That's the way that I've always tended to do it, but using lines as
often it's easier than counting...

So...

:set nu
:s50,200/^/#/g

...where lines 50-200 are the ones you want to comment.

Sean



More information about the ubuntu-uk mailing list