->Title Page
->Vi editor
-->Vi reference
--->Move commands
--->Changing text
--->Insert mode
--->Display commands
--->Shell commands
--->Vi Startup
--->Important options
-->Miscellaneous tips
->Mirror sites
->Further reading

[ Up ]

Vi ---> Macros

When mapping take a look at the options to and remap (below).

    :map <string> <seq>     | <string> is interpreted as <seq>, e.g.
                            |   `:map ^C :!cc %^V<cr>' to invoke `cc' (the C
                            |   compiler) from within the editor
                            |   (vi replaces `%' with the current file name).
    :map                    | Show all mappings.
    :unmap <string>         | Deprive <string> of its mapping.  When vi
                            |   complains about non-mapped macros (whereas no
                            |   typos have been made), first do something like
                            |   `:map <string> Z', followed by
                            |   `:unmap <string>' (`Z' must not be a macro
                            |   itself), or switch to `ex' mode first with `Q'.

    :map! <string> <seq>    | Mapping in append mode, e.g.
                            |   `:map! \be begin^V<cr>end;^V<esc>O<ht>'.
                            |   When in append mode <string> is preceded by
                            |   `^V', no mapping is done.
    :map!                   | Show all append mode mappings.
    :unmap! <string>        | Deprive <string> of its mapping (see `:unmap').
    :ab <string> <seq>      | Whenever in append mode <string> is preceded and
                            |   followed by a breakpoint (e.g. <sp> or `,'), it
                            |   is interpreted as <seq>, e.g.
                            |   `:ab ^P procedure'.  A `^V' immediately
                            |   following <string> inhibits expansion.
    :ab                     | Show all abbreviations.
    :unab <string>          | Do not consider <string> an abbreviation
                            |   anymore (see `:unmap').
    @<a-z>                  | Consider the contents of the named register a
                            |   command, e.g.:
                            |       o0^D:s/wrong/good/<esc>"zdd
                            |   Explanation:
                            |       o              - open a new line
                            |       0^D            - remove indentation
                            |       :s/wrong/good/ - this input text is an
                            |                        `ex' substitute command
                            |       <esc>          - finish the input
                            |       "zdd           - delete the line just
                            |                        created into register `z'
                            |   Now you can type `@z' to replace `wrong'
                            |   with `good' on the current line.
    @@                      | Repeat last register command.

Please notify owners of webpages with outdated links to these pages

This section is based on "Vi Reference" by Maarten Litmaath et al.

Find this site useful? Want to give something back?

© 1993-2001 Christopher C. Taylor