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

Johnathon Tinsley kirrus at kirrus.co.uk
Wed Aug 20 12:25:46 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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
> 
> EDIT: I forgot, if you want to do a range from the current cursor position you
> can do it as '.,+x' where x is the number of lines after the one you're on.
> 
> e.g. ':.,+4s/^/# /' would comment out the line you're on and the four after it.
> 
<snip>

Thanks for all the suggestions!

I'll try them out next time I have to comment out some stuff :)

Johnathon


- --
Blog: http://kirrus.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIq/8681bUwCB/xdgRAgvPAKDMyq2EDLW+x72zSbkqCj9W0+/I/wCg6T1r
ChYFK4OGbLWkJq/dnJmGDQc=
=o3z0
-----END PGP SIGNATURE-----



More information about the ubuntu-uk mailing list