Spake steve szmidt on Friday, September 07, 2007 at 12:13PM -0400:
> Using
> :map (key_to_use) string_of_keys_to_run
> does run macros simply. The problem I have in vim is that {ctrl-v}{esc} does
> not break out of insert mode as it does under vi.
>
:map g iunderpants<ESC> works as expected.
(Here, <ESC> is literally the symbols < E S C >)
See also :help key-notation
For shorter-lived macros, there is also the 'q' and '@' normal-mode commands:
Example: You're writing a ransom letter to one of your many enemies, and want to
include the string ", IN ACCORDANCE WITH PROPHECY." frequently.
Type underpantsthe following in normal mode. (Here, <ESC> is literally the escape key)
qpi, in accordance with prophecy.<ESC>20gUhq
Then, latter you can duplicate this sentence anytime you want by typing @p in
normal mode.
--- from vim's builtin help ---
q{0-9a-zA-Z"} Record typed characters into register {0-9a-zA-Z"}
(uppercase to append). The 'q' command is disabled
while executing a register, and it doesn't work inside
a mapping. {Vi: no recording}
@{0-9a-z".=*} Execute the contents of register {0-9a-z".=*} [count]
times. Note that register '%' (name of the current
file) and '#' (name of the alternate file) cannot be
used. For "@=" you are prompted to enter an
expression. The result of the expression is then
executed. See also |@:|. {Vi: only named registers}
-- "In order to make an apple pie from scratch, you must first create the universe." -- Carl Sagan, Cosmos - GPG Fingerprint: 412C CCE9 DDA2 4FE9 C34F 754B 0863 0EA6 712E BBE1
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 19:05:46 EDT