Team LiB   Previous Section   Next Section

11.10 Macros

Command

Action

:ab in out

Use in as abbreviation for out.

:unab in

Remove abbreviation for in.

:ab

List abbreviations.

:map c sequence

Map character c as sequence of commands.

:unmap c

Disable map for character c.

:map

List characters that are mapped.

:map! c sequence

Map character c to input mode sequence.

:unmap! c

Disable input mode map (you may need to quote the character with Ctrl-V).

:map!

List characters that are mapped to input mode.

qx

Record typed characters into register specified by letter x. If letter is uppercase, append to register.{vim}

q

Stop recording. {vim}

@x

Execute the register specified by letter x. {vim}

In vi, the following characters are unused in command mode and can be mapped as user-defined commands:

Letters

g K q V v

Control keys

^K ^O ^T ^W ^X

Symbols

_ * \ =

The = is used by vi if LISP mode is set. vim uses all of these characters, but you can create macros for function keys and multiple character commands. See :help :map for details. Other versions of vi may use some of these characters as well, so test them before using them.

    Team LiB   Previous Section   Next Section