Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Using Your HP Workstation > Chapter 17 Using the vi Editor

Making Your vi Environment Permanent

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

To avoid setting options or defining abbreviations or macros each time you enter vi, place all options and definitions you normally use into an .exrc file in your home directory. This file is read automatically each time you enter vi and its contents make your customized vi environment permanent.

To create or change the .exrc file, follow these steps:

  1. Type cd at the HP-UX prompt to ensure that you're in your home directory; then use vi to create or edit the .exrc file:

       cd
    
       vi .exrc
    

  2. Type the options, word abbreviations, and macros you want to make permanent (don't precede the commands with a colon).

  3. Type :wq to save the text and exit vi.

After creating the .exrc file, you can access it whenever you want to change your vi environment. Any of the editor options discussed in the previous section can be placed in this file.

An Example of Changing Your .exrc File

In “Using Options to Change Your vi Environment”, you saw examples of some of the options that change the overall behavior of vi. You can also make vi recognize short forms of commonly used expressions by using ab to define an abbreviation.

If you include the following options and abbreviations in your .exrc file:

   set wm=8 

   set showmode 

   ab eeg Electrical Engineering 

   .

   .

   .

Then you have changed your vi environment so that each time you enter vi, you can expect the following:

  • The right margin automatically contains eight spaces (changing the default from zero), and a carriage return will occur after approximately 72 spaces.

  • The lower right part of the screen will show "INPUT MODE" when you are in any of the text insert modes.

  • Whenever you enter eeg, this abbreviation will automatically expand into the words Electrical Engineering.

For more information on this versatile editor, see The Ultimate Guide to the vi and ex Text Editors.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© © 1983-1995 Hewlett-Packard Development Company, L.P.