home *** CD-ROM | disk | FTP | other *** search
- Vi macro management:
- - if possible don't repeat character sequences in different macros, put them
- in their own macros;
- - try to be concise, e.g. instead of "map @i :set noautoindent^V^M" use
- "map @i :se noai^V^M";
- - don't try to solve difficult problems in vi, create appropriate shell
- scripts instead, to be invoked through maps;
- - create specialized macro files, to be sourced only when appropriate,
- you don't need all your maps all the time, e.g. "map ^C :!cc % " isn't
- that useful when editing a letter to your friend; you might even create
- shell scripts to do the sourcing for you -
-
- % cat ~/bin/cvi
- #!/bin/sh
- /usr/ucb/vi +"so $HOME/.cmaps" ${1+"$@"}
- %
-
- However, this script reveals an interesting bug: the source command will only
- take place when the first EXISTENT file is read into the buffer!
- A better idea than hacking the shell script is to define a standard macro
- (in EXINIT) to source ~/.cmaps:
-
- map\C :unm\C^V|so~/.cmaps^M
-
- No unnecessary spaces! :-)
- When ~/.cmaps has been sourced, the `\C' macro can be deleted, hence the `unm'.
-