[oclug] Vim Rulez (was Programming Wars - Final Results)
Michael P. Soulier
msoulier at storm.ca
Wed Apr 18 22:22:03 EDT 2001
On Wed, Apr 18, 2001 at 07:46:31PM -0400, Vic Gedris wrote:
> OK...I have to bite on this one. :-)
> "Regular editor": <home><bksp> a (2 keystrokes)
> vi: <esc><up><shift-j>i (5 keystrokes)
> vim: <home>bksp> (2 keystrokes! ;-)
Yeah, what's the setting to enable that Vic? I think by default backspace
at the beginning of a line does nothing just like Vi, but you can enable it.
> But as Mike already pointed out, vi/vim is amazing when editing with
> multiple lines.
And even better is Ex, the line editor that Vi is built on. Try this is
Replace instance of "rocks" with "rules", but only if it appears
immediately after "linux", at the beginning of the line.
:%s/^linux rocks/linux rules
One liner in Vi. On the list of Ex lessons, that's about number 2. The
capabilities are quite impressive. I have Ex scripts at work for enforcing
certain rules in code, or cleaning out annoying characters, and they're very
fast. The great thing about an Ex script is that it lets you alter the file in
place. No messing with tempfiles.
Michael P. Soulier <msoulier at storm.ca>
"With sufficient thrust, pigs fly just fine. However, this is not necessarily a
good idea. It is hard to be sure where they are going to land, and it could be
dangerous sitting under them as they fly overhead." -- RFC 1925
More information about the OCLUG