| In addition to reading configurations from your shell, the vi editor will also read configurations from a text file, and since we've already shown you how to use it (in Chapter 6), we'll show you some common configuration settings you may want to use. To configure vi: | 1. | Open your ~/.exrc file (using vi or any other text editor). | | 2. | Add the setting(s) you wish to use. For example, 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 window, add a line that says set wm=5 | | 3. | To set a tab stop every four spaces (instead of the default eight), add a line that says set tabstop=4 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 | S ETTING | M EANING | | set autoindent | 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. | | set extended | Allows extended regular expressions to be used in searches. In Chapter 4, "Useful Unix Utilities," see the section "Searching for Text" for a discussion of regular expressions. | | set ruler | Causes vi to display the position of the cursor at the bottom of the window (as two numbers : line, column). | | set showmode | Displays the current mode (command or insert) on the status line. | | set tabstop=n | Tells vi how many spaces between each tab stop. If you set it to 4, then pressing will advance the cursor only four spaces. | | set wm=n | 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 window. | | | 4. | Save the file. | | 5. | Quit. That is: :wq The new settings will be in effect the next time you use vi . | Tip -
You can turn off a setting with :set no settingname For example, to turn off auto-indent, you would use :set no ai |