vi editing  «Prev  Next»
Lesson 6 Configuring your editing environment
ObjectiveUse the :set command to configure vi.

Configuring editing environment(for vi)

By default, text searches are case sensitive[1]. For example, /tow will match the pattern town but not Town. The ignorecase option causes text searches to see uppercase and lowercase letters as identical. For example, /tow will match town or Town.
Most configuration options have a short form. For example, ic is the short form for ignorecase, so you can turn it on like this: :set ic: To turn ignorecase off again and restore vi's default behavior, enter this:
:set noic Other useful configuration options include wrapmargin and number.
In addition to defining options, you can also display options in two ways.
If you enter :set by itself, vi lists any options that have changed from their default values. To display vi's entire list of options, enter the :set all command.

The following SlideShow demonstrates the :set command. 1) Set Options 1 2) Set Options 2 3) Set Options 3 4) Set Options 4 5) Set Options 5 6) Set Options 6 7) Set Options 7
  1. Start by opening the quartet file in vi.
  2. Enter the set command to list options that have changed from their defaults.
  3. The set command lists three changed options: redraw, showmode and term=vt100.
  4. The redraw and term options ensure that vi correctly displays text on your terminal.
  5. You can explicitly change options within your version.
  6. Later on, you can enter the set command to check your options again.
  7. The listing now shows the ignorecase option that you turned on.

vi Configuration Options
vi provides many configuration options that let you change your editing environment. You manage these options by using the :set command, as shown below:
General Form Description Example
:set option Turn on the option :set ignorecase
:set nooption Turn off the option :set noignorecase
:set option=value Assign value to the option :set wrapmargin=10

In the next lesson, you will learn how to store abbreviations, maps, and configuration options to make them permanent.

Customize vi - Exercise

Click the Exercise link below to test your knowledge about configuring an editing session.

[1]case sensitive: When a text search is case sensitive, the search treats uppercase and lowercase letters differently. If uppercase and lowercase letters are treated the same way, then the search is considered to be case in-sensitive.