Options in vi
You have three methods of specifying options with the vi editor. All have their place, but if you find yourself frequently having to set options manually, try putting them in the ~/.exrc file. An example is shown here:
set number set tabstop=5 set nohlsearch
The previous code should be placed in the .exrc file, one option per line, the file being a simple text file in the user's home directory.
If you want all users to have the exact same vi options, edit the /etc/exrc file to set the options.
Having this in the user's home directory or having a customized one in a folder you specify uses the file found in the local directory (if any) as the active configuration file when you start a vi session. If there isn't one in the current directory, the user's ~/.exrc is used if it exists; otherwise, the defaulting system /etc/exrc file is used if it is configured.
To set options on-the-fly, enter them at the : prompt, such as :set number, :set noerrorbell, and set tabstop=5. These last only for the current session and have to be repeatedly reset in future sessions.
Your final option for setting an option with vi is on the command line that started vi. For example, to start vi with nonprinting line numbers onscreen, you would use
vi +"set number" file1
The reason for the double quotation marks is the space between set and number; otherwise, it would give you a syntax error.
More than 60 options are available in the vi editor. You can view them easily by typing :set all in the editor, or to see which options are currently set for your session, type :set while in the editor. Finally, you can type :set optionname? to find out about that particular option's status.
For some reason, LPI really wants you to know the options for setting numbers, including the shortcuts for how options are set. Examples of how you could set the numbers option on and off include
:set numberTurns on line numbers (screen only).
:set nonumberTurns the number option off.
:se nuThis is the shortest string that turns this option on, and putting no in front of the option turns that option off.