This section describes some advanced functions of VI and Ex.
Configure vi
The configuration file. exrc can be saved in your home directory and executed when VI is started. However, you can place a configuration file in the current working directory to customize the configuration of the current directory.
: Set command
: The SET command has two parameters: one is a switch parameter, which indicates that the set command is enabled or disabled; the other is a common parameter followed by a number or a string.
The default value of the switch parameter is set Option: Enable: Set nooption: Disabled. For example: Set IC (case-insensitive search) and set noic (case-sensitive search)
Some parameters must be assigned values: Set option = value. For example, set window = 20 (20 rows are displayed on the current screen)
: Set all ---- view all current parameters
: Set option? ---- View the value set for the current Parameter
: Set ---- which parameters are modified in reality, relative to the. exrc file or the current session
Configuration File. exrc
You can use VI to edit the. exrc file. If this file is not found in the main directory, you can use VI to create the file. Use the SET command in the. exrc file without the colon.
Alternative Environment
When VI is started, it first reads the. exrc file in the U user's home directory, and then the. exrc file in the current working directory. The settings in the current working directory overwrite those in the home directory.
You can also use the. exrc file to save the current environment configuration. In this case, you must use the "so (source)" command to read custom files.
Some useful settings
: Set wrapmargin = 10 ---- automatically wrap a line when the input to the right boundary has 10 Characters
: Set ignorecase/noignorecase ----- ignore case sensitivity/Case sensitivity when searching. noignorecase defaults
: Set wrapscan/nowrapscan ---- sets whether the entire file can be traversed by any search in the file. wrapscan defaults
: Set magic/nomagic ---- set whether wildcard numbers can be used for search. Magic defaults
: Set autoindent/noautoindent ---- set Automatic indent
: Set showmatch/noshowmatch ---- set whether to display matching parentheses
: Set tabstop = 8 ---- set the number of spaces in the tab File
: Set shiftwidth = 8 ---- set the auto indent width
: Set number/nonumber ---- set whether to set the actual row number
: Set list/nolist ---- set whether to set the end position of each row (? The result I see is)
: Set autowrite/noaautowrite ---- set to automatically save changes to the current file when you use: n to edit the next file or run the shell command
Vim uses zhibei ---- advanced editing