vim function

Paul Seamons paul at
Fri Aug 11 09:27:21 MDT 2006

> blah blah IFcondition<ESC><DOWN>a<TAB>write true handler (6 non-code 
keystrokes assuming you are in already in insert mode and want to stay there 

Hi Alan.

Just thought I'd jump in with a jibe at Vim - well maybe not at Vim but just 
at the macro (I don't want an editor flamewar so I'll argue Vim vs "most 
other editors" rather than Vim vs emacs because we all know that "to save the 
file in emacs you need to simultaneously press the keyboard with 7 fingers, 2 
toes, and your forehead - in some cases hitting hard enough with just your 
forehead may suffice" :).

In many other editors, you would type the following (which costs 3 more key 
strokes (actually, many editors wouldn't need the <TAB> so it would only be 2 

blah blah if<SPC>(condition)<SPC>{<CR><TAB>write true handler<CR>} (9 non-code 
keystrokes - 8 if the editor supports autoindentation)

In this case, 
a) it isn't all that hard to type
b) it doesn't need the macro
c) it puts you right after the } in case you want to start right into a 
following else or elsif (else if for most)

to get there with that macro you'd have to type the following:

blah blah IFcondition<ESC><DOWN>a<TAB>write true handler<ESC><DOWN>a (8 
non-code keystrokes)

Without the macro in vim you'd have the following:

blah blah if<SPC>(condition)<SPC>{<CR><ESC><TAB>a write true handler<CR>} (13 
non-code characters - if vim autoindents on the first <CR> then it is only 

Some things make coding easier, some are fun, some are wow.  It is up to the 
developer to decide which categories each new thing falls into.

I'm not meaning to be rain on somebody's parade, just a glance from a few 
steps back.


More information about the PLUG mailing list