Learn the basic operation of VIM by Vimtutor this brief tutorial
Two move cursor: H: Left L: Right K: Upper J: Lower
Three Vim entry and exit
1. Enter: Vim + filename Enter or VIM + ENTER
2. Exit: 1:q Key Exit-Do not save
2:q! force not to save exit
3:w Save file contents, but do not exit
4:wq Save the contents of the file and then exit
Four VIM edit delete instruction
1.x: Delete the character that the current cursor contains
2.DW: Delete a single word or a word, mainly separated by a blank character. (Include whitespace characters when deleting)
3.de: Single word or word, excluding white space characters when deleted
4.d$: Delete all content at the end of the line at the cursor location
5.d^: Removes all content from the cursor position to the first line
6.DD: Delete entire line contents
7.D: Remove all content from the cursor position to the end line
Five delete syntax [number] D object numbers represents the frequency of the execution of the command word D
Six VIM commands from command mode to input mode
I: refers to inserting content from the current cursor position
I: Refers to inserting content from the beginning of the current cursor
A: The insertion begins at the first position of the current cursor position
A: Is the insertion of the content from the end of the line at the current cursor position
O: Refers to the insertion of the content from the next line of the current cursor
O: Refers to the insertion of the content from the previous line on the row where the current cursor is located
Seven vim Undo Class command
U: Undo last executed Instruction
U: Reply to the entire line of content
Ctrol+r: Undo Undo Command
Eight copy, cut, paste class commands
1:yy + P combination for copy and paste functions
2:DD + P combination for cut and paste functions
For YY and DD, it is possible to add a number to the preface of the command, indicating the number of times the instruction was executed.
Nine substitution class directives
1. R: Replace the current cursor character, features: After the modification, still in command mode
2. R: Replace all content after cursor position, feature: original content will not be deleted, just replace the old content with the new input
3. CW: Delete the word or words after the current cursor position and switch to input mode, including spaces
4. CE: Delete the word or content after the current cursor position and switch to input mode, excluding spaces
5. C $: Deletes everything after the current cursor position and enters insert mode
6. c^: Delete Everything before the current cursor position and enter insert mode
To replace the command format of a class:
[number] C object or C [number] Object
10 positioning of files and obtaining of file information
1. Ctrl+g: Gets the information of the file and the line number of the current cursor
2. Shift+g: Jump to the last line of the file
3. Digital +shift+g: Jump to the specified line number position
4. Use: Number to jump to the specified line number position
11 Search function
1./: Search backwards from the current location of the file
2.? : From the current location of the file, search forward (the location of the file line number is small), use N to find the next content, n find the previous content
3. S: Specify a specific number of rows to find. Specific syntax format: s/old/new/g find old This string, with the new string to replace, if followed by a G, to replace the entire line of content
4.%s: means to find all the contents of the entire file, in specific syntax format:%S/OLD/NEW/GC
12 Pair of brackets
% to confirm the pairing problem of the current parenthesis () [] {}
13 ability to perform external commands within VIM
:! + External command to complete the function of external commands within VIM
14 Writing, extracting, merging of files
1.: W enables saving the contents of the current file as a different file
2.: r implementation reads the contents of other files after the current cursor position of the current file
For the above two functions, you can specify the range of rows to implement writing and reading portions of the content
XV Set class command
1. Set Number setting line numbers
2. Set Nonumber Cancel line number
3. Set HLS is settings when looking for a string, highlight
4. Set Nohls Cancel highlighting
5. Set IC settings when looking, case insensitive
6. Set Noic when the settings are found, case sensitive
16 page
Control + F turn down one page
Control + B turn up one page
Control + U turn up half page
Control + D turn down half page
Vim Editor Main content