In addition to reading configurations from your shell, the vi editor will also read config-urations from a text file, and since we've already shown you how to use it (in Chapter 6, "Editing and Printing Files"), We'll show you some common configuration settings you may want to use.
To configure vi:
Open your ~/.exrc file (using vi, of course!).
Add the setting(s) you wish to use. For example, to display the current mode (command or insert) on the status line (very useful for beginners!):
To have word wrap (indicated by wm) always be on, and to set it to kick in within five characters of the right edge of the screen, add a line that says
To set a tab stop every four spaces (instead of the default eight), add a line that says
Table 7.6 lists some common setting possibilities, and of course you should read the vi man page to see the full list.
Table 7.6 Common vi Configuration Settings
Vi will insert tabs and spaces at the start of each line to make the first character you type line up with the first character of the line above.
Allows extended regular expressions to be used in searches. See Chapter 4, "Useful Unix Utilities," the section "Searching for Text," for a discussion of regular expressions.
Causes vi to display the position of the cursor at the bottom of the window (as two numbers: line,column).
Displays the current mode (command or insert) on the status line.
Tells vi how many spaces between each tab stop. If you set it to 4, then pressing twill advance the cursor only four spaces.
Turns on automatic word wrap. Vi will automatically insert a new-line character when you get within n columns of the right edge of the screen.
Save the file.
The new settings will be in effect the next time you use vi.