->Title Page
->Intro
->Unix
->Vi editor
-->Basics
-->Vi reference
--->Move commands
--->Search
--->Undo
--->Insert
--->Delete
--->Changing text
--->Substitution
--->Yanking
--->Insert mode
--->Display commands
--->Files
->Macros
--->Shell commands
--->Vi Startup
--->Important options
-->Miscellaneous tips
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

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.

Site Statistics

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

t a y l o r@l i n u x b o x.c o m

© 1993-1998 Christopher C. Taylor