vi Macros


Previous Index Next



Warning! vi macros are only properly supported on some clones. Some have access to other scripting languages such as perl

The @ command

Executes commands in a buffer as though you typed them. Just type them then use yank to get it to a buffer.

e.g.
f(T "zyt(f;s {
} /* Esc"zpa */ Esc
Turns a C decleration - e.g. void foo(int x); into an empty C definition - e.g.
void foo(int x) {
} /* foo */

Note: To enter an Escape (or other control character) type ctrl-V first then type the control character you want to insert

The :map command

You can remap any keypress by using :map or :map! If you want the mapping to work in insert mode - e.g.

:map! #1 Esc:!makeReturn

#1 is a special which means function key 1 - but normal characters can be mapped as well


Copyright Dr. David Alan Gilbert 2001. vitalk @ treblig.org - Hacked together with dsh