9.1 The vi Editor
9.1.8 Advanced editing options (last-line mode)
Edit Session Customization Commands
The vi editor includes options for customizing your edit sessions. These are summarized in Figure and include displaying line numbers and displaying invisible characters such as tab and end-of-line characters. The
set command is used from last-line mode to control these options. These options can also be placed in a file the user creates in their home directory called .exrc. The set options are placed in this file, without the preceding colon, one command to a line. Once the .exrc file exists, it is read by the system each time a vi session is opened. The set nu option shows line numbers and is used frequently when writing programs and script files. The line numbers are not part of the file.

Advanced Editing and Searching
The commands in Figure allow you to perform advanced editing such as finding lines or conducting search and replace functions. Note that the forward slash (/) and the question mark (?) search options are also last-line commands, but they do not require a colon first. The next (n) and next previous (N) commands can be used to find the next occurrence after the /string or ?string commands found what you were looking for.

Lab Activity (Adobe Acrobat Reader, 65 kB)
  Using the vi Editor

In this lab, you will use a UNIX text editing tool: the vi (pronounced "vee eye") editor. This text editor is primarily used for creating and modifying files that customize your work environment and for writing script files to automate tasks.