|
from small one page howto to huge articles all in one place
poll results
Last additions:
May 25th. 2007:
|

.
You are here: Misc->VI
4. Startup File
Having explored vi commands somewhat, we are now ready to create a default editing environment through the use of .exrc, the configuration file which resides in user's home directory.
.exrc typically contains at least three types of entries:
- set commands to create preferred editing environment
- map commands to assign functions or macros to keys
- ab commands to either map abbreviations or automatically
correct common spelling errors
When mapping escape sequences of some keys, we may need to quote them, that is, to insert them literally. This can be accomplished in vi by issuing a text input command and pressing Ctrl-V before the key we wish to quote is pressed.
Now let's look at a sample .exrc:
set autoindent set wrapmargin=8 set ignorecase map #4 !}fmt^M ab teh the ab cutsomer customer
Lines 1 and 2 set autoindent mode on and turn on wordwrap at column 72. Line 3 specifies that all searches are to be case insensitive. Line 4 maps function key 4 to reformat from the cursor position to the end of the paragraph. Finally, lines 5 and 6 map some common misspellings to the correct spelling. Note that ^M on lines 4 and 5 are created by pressing Ctrl-V and then hitting Ctrl-M.
With a little creativity you can make vi look as personal as you wish.
NOTE: After creating .exrc make sure that EXINIT environment variable is not set as it would overwrite whatever settings you entered into .exrc. You can verify whether the EXINIT variable is set using this command from the UNIX command prompt:
$ set | grep EXINIT
If you see no output, you're fine.
Make sure that .exrc contains no blank lines - they are not allowed.
/* The article above and any accompanying files are freely * distributable, but please leave this notice and the text intact. * Home for this document: http://www.infobound.com/vi.html * Copyright (C) 1994, 1999 Tony Thomas * Contact author through email:tony@infobound.com * Last revision Feb 23, 1999 * UNIX is a trademark of X/Open */
rate this article:
current rating: no votes yet
Your rating:
back comment this article
Please read "Why adblockers are bad".
Ärger mit Freenet.de
|
other Ads
Other free services
.
.
|