Wade asked: > Yes, that is what I want. Add a "#" to the begging of six lines in a > row for example.
:.,+6s/^/#/ Breaking down that command, you have: : = switch to command mode .,+6 = apply this command to this line (.) and the following 6 (+6) s = substitute (a la "sed") with regexp to follow /^/#/ = change start-of-line (^) to a pound sign (#) > Or remove a "#" from several lines in a row. :.,+10s/^#// Which translates to: : = switch to command mode .,+10 = apply this command to this line (.) and the following 10 (+10) s = substitute (a la "sed") with regexp to follow /^#// = change start-of-line and pound sign (^#) to nothing (//) Another super-handy thing is the dot operator, which repeats your last command. Let's say you delete a line (using "dd") and then want to delete the next one too. You can type "dd" again, but of course that requires TWO keystrokes (the horror!)... so just type "." and it'll repeat. That's very handy when you have more complicated commands like change-word etc. For your example, you might be adding pound-signs to the start of lines. So you're on the line and you type I#<esc> Note that capital "I", which will insert at the beginning of the line, no matter where the cursor is. Then go down a line and hit period, and you'll add a pound there too. Rinse and repeat. vi is very cryptic, as I'm sure you've discovered, but once you know the tricks it's incredibly powerful. More than, I daresay, Emacs. * HTH, Jeff * Just kidding. Emacs is great. Really. Let's not start a war. :)
signature.asc
Description: This is a digitally signed message part.
/* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
