DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Editing files

Saving frequently used commands

If you have a set of commands that you use frequently, place them in a file called .exrc in your home directory. Whenever vi starts up it will look for this file and execute any commands or mappings it sees in it. The mappings will be available to you in every vi session without the need to retype them each time.

You can place comments in your .exrc file to tell you what your commands do, by starting a line with a ``#''; this tells vi to ignore the line. For example, your .exrc file might look like this:

   # My .exrc file. Last changed: 20-March-1995
   #
   # Define where new lines are to be inserted automatically
   :set wrapmargin=15
   # Allow special characters in search patterns without using backslash
   :set nomagic
   # Define an abbreviation
   :ab eC European Community
   # The % key in command mode now reads in the file .address
   # at the top of the current file
   :map % ma1G^:r /u/roberta/address^M`a
   


Next topic: Using ed
Previous topic: Configuring vi

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003