[ubuntu-uk] Advanced vi/vim command - commenting out a large section
DarkOtter
hello at darkotter.com
Mon Aug 18 18:42:47 BST 2008
> 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.
Also, you could use the program 'boxes' with the range if you want, e.g.
':.,+4!boxes -d shell'.
P.S. Sorry for double posting, I should think longer before I send to avoid
forgetting stuff :P
--
__ ___ __ __
/ |/ /__ _/ /_/ /_
/ /|_/ / _ `/ __/ __/
/_/ /_/\_,_/\__/\__/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/ubuntu-uk/attachments/20080818/db309d9c/attachment.pgp
More information about the ubuntu-uk
mailing list