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.
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 |
Customizing vi
set: List configuration options that have changed.
set all: List every configuration option.
set ic: Cause searches to treat uppercase and lowercase letters the same.
set noic: Cause searches to treat uppercase and lowercase letters differently.
map: List your command shortcuts.
ab: List your shortcuts for adding text.
In the next lesson, you will learn how to store abbreviations, maps, and configuration options to make them permanent.
[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.