1. Start
-R Read-only mode, but if you have permission to do so, you can force the save.
-C (command) after loading executes the command, such as "Vim-c/most myfirst" Open the file, and then search directly backwards most.
More can refer to-h
2. Edit multiple files at the same time
Vim [file1] [file2] ...
Now
: AR View the file name of the current edit
: N Toggles the currently edited file
In addition, there are
: e Switch to new file
: W reads the existing file and puts its contents in the file being edited
: w [start line] [end line] [filename] places the current file portion in a new file, overwriting if it already exists.
3. Text rearrangement
in command mode
DD deletes the current row and holds it in a temporary buffer (similar to cut)
YY Copy the current line and store it in a temporary buffer
P places the contents of the specified buffer below the current cursor position
P puts the specified buffer content above the current cursor position
4. Domain Operations
Operators (d, Y, and so on) are combined with domains to perform domain operations.
Domain |
Function |
$ |
The identity field starts at the cursor position to the end of the current line |
0 |
The identity field is from the cursor position to the current beginning |
E or W |
The identity field begins at the cursor position to the end of the current word (other uses: such as 3DW, 3 words after removing the cursor) |
B |
The identity field is from the cursor position to the current word header |
5. Use of buffers
5.1 Number Number Buffer
Double quotation mark +n (buffer number, 1 to 9) + (p or p)
For example, "9p
In which the use of the digital buffer, delete or copy, each of the areas after the move, 1 to 2, 2 to 3,......,9 original was emptied and 8 covered.
5.2 Letter Number Buffer
Double quotation mark + buffer name (from small letters A to Z) + command
Practice cases:
"Wdd deletes the current row, the copy is saved in the buffer W
"WP copies the buffer w content to the cursor position
"Z7yy copy 7 lines to buffer Z
"ZP the contents of the buffer Z (7 rows) to the cursor position
6. Cursor Positioning key
[ctrl-d]
key |
function |
TD valign= "Top" width= "127" >
[ctrl-u]< /p> |
|
[ctrl-f) |
|
[ctrl-b" |
|
7.Vim customization Options
7.1:set
: Set all shows all options
: Set shows only modified options
: Set X? Display value for option X
Set the way
Boolean option: Set X designates, set NOx prohibited
Digital options: Set x=12
String options: Similar to numeric options, but assigned to a string
Some options:
Options |
Abbreviation |
Function |
Autoindent |
Ai |
Aligns a new row with the beginning of the previous line |
IgnoreCase |
Ic |
Ignore case in Search options |
Number |
Nu |
Show line Numbers |
Shiftwidth |
Sw |
Sets the number of spaces to indent, used with the autoindent option |
Wrapmargin |
Wm |
Sets the right boundary to the specified number of characters |
7.2 abbreviation
: AB UNO Unix Operating system sets Uno to the UNIX operating system abbreviation, and the input Uno plus a space is automatically replaced.
: Unab uno Cancel abbreviation
7.3 Macro Actions
: map [Macro name] [action function key sequence]
Macros are temporary and work only in the current editing session.
All of the settings (set, abbreviation, macro) in this section are temporary, and you should create an. exec file in the current (working) directory to save the settings if you need to use it for a long time. Content is shaped like
Set report=0
AB UOP UNIX Operating System
Map Q 5DD
8. Other Orders
8.1 Running shell command
:!+ Command For example:!date
8.2 Line Connection J
8.3 Search and replace
Use/or//Enter +n+.+n+.+ ... You can implement bulk substitution