1. Vim mode:
Edit mode (Command mode)
Input mode
Last-line mode
2. Mode conversion:
<1. Edit--Input
I: Switch to input mode before the current cursor character
A: After the current cursor character, switch to input mode
O: Create a new row below the current cursor line and switch to input mode
I: Switch to input mode at the beginning of the line where the cursor is currently located
A: At the end of the line where the current cursor is located, switch to input mode
O: Create a new row above the current cursor line and switch to input mode
<2. Input--Edit
ESC key
<3. Edit-last-line mode
Enter ': '
Set NU Display line number
<4. Last-line mode--edit mode
ESC key
One: Open file
Vim +#: Open the file and locate it on line #
Vim +: Open the file and navigate to the last line
Vim +/passent (String): Opens the file and navigates to the beginning of the line that was first matched to the pattent
Default in edit mode
Two: Close the file
1. Closing the file in the last line mode
: Q exit
: Wq Save and exit
:!q do not save and exit, Force quit
: W Save
: w! Force Save
: wq--": X Command same
2. Exit in edit mode
ZZ: Save and exit
Three: Move cursor (edit mode)
1. Character-by-word movement
H: Move one character to the left
L: Move one character to the right
J: Move Down one line
K: Move up one line
#h: Moving a # character
Note: #为数字
2. Move by word
W: Move to the beginning of the next word
E: Jumps to the ending of the current or next word
B: Jump to the beginning of the current or previous word
#w: Move to # words
3. Jump in line to
0: Jump to the beginning of an absolute line
^: jumps to the first non-whitespace character at the beginning of a line
$: absolute end of line
4. Jump between rows
#G: Jump To Line #
G: Last line
In the last line mode, directly to the travel number can be
Four: Flip screen
CTRL+F: Flip a screen to the end of the file
Ctrl+b: Turn up one screen
Ctrl+d: Flip Down half screen
Ctrl+u: Flip up half screen
Five: Edit command
Delete a single character
X: Command
#x: Remove the total # characters from the cursor and backwards
Six: Delete command
D:D command combined with jump to command
#dw #de #db
DD: Delete cursor in the row
#dd: Delete the # line that contains the line in which the current cursor is located
In the last row mode
First row, last line dd Delete all rows of the first and last rows such as: 1,5DD
.: Indicates when the forward
$: Last line
+#: Down # line
Seven: Paste command
P: If you delete or copy a positive row, paste to the bottom of the line where the cursor is located, and if the copied or deleted content is a non-full row, paste it after the character that contains the cursor
P: If you delete or copy a positive row, paste to the top of the line where the cursor is located, and paste to the front of the character where the cursor is located if the copied or deleted content is not a whole line
Eight: Copy command
Y command: Use the same as D command
IX: Modify: Delete content first, in convert to input mode
C command: Same as D command
Ten: Replace command
R command
R: Replacement mode
11: Undo Edit Operation
U: Undo the previous edit operation
Continuous U-command to undo previous N Edit operations
#u: Undo Recent # edits directly
Undo Last Revocation: ctrl+r
12: Repeat the previous edit operation
The "." Command
13: Visualization Mode
V: Select by character
V: Select by rectangular block
14: Find
/characters: Looking back from the past
/? characters: Looking forward from behind
N: Jump down case
N: Jump Upwards
XV: Find and replace
Use the S command in the last-line mode
Start address, end address s/find character/replace character/gi
G: Global Substitution
I: Ignore characters
%: Indicates full-text find and replace
16: Edit multiple Files with vim
Vim File1 file2
: Next switches to the next file
: prev Switch to previous file
: Last switch to final file
: first to switch to file one
Exit
: QA exits all files and exits all
17: How to display a file in Split screen
Ctrl+w,s: Horizontal splitter window
Ctrl+w,v: Vertical splitter window
Toggle the cursor between windows
Ctrl+w,arrow (up and down arrows)
: QA Closes all windows
18: Sub-Windows Multiple files
Vim-o file1 file2 Horizontal split display
Vim-o file1 file2 Vertical split display
19: Save some of the contents of the current file as a different file
Use the W command in the last row mode
: Start line, end row W/path/to/somewhere Save as Directory
20: Fills the contents of another file in the current file
: R file path
21: Interacting with the shell
:! Execute command
22: Advanced Topics
1. Display or suppress line numbers
: Set NU Displays line number
: Set Nonu Cancel line number
2. Display ignores or distinguishes character case
: Set IC ignores case
: Set Noic does not ignore case
3. Set Auto Indent
: Set AI Auto Indent
: Set Noai Cancel Auto Indent
4. The found text is displayed or the highlight is not displayed
: Set Hlsearch Set highlighting
: Set Nohlsearch Suppress highlighting
5. Syntax highlighting
: Syntax on syntax highlighting
: Syntax off syntax highlighting
23: Configuration file
/ETC/VIMRC Global configuration file
~/.VIMRC Local Profile User home directory
Note: vimtutor command vim use Tutorial (System comes with
This article is from the "Linux Operations Technology Exchange" blog, please be sure to keep this source http://linuxzhang.blog.51cto.com/2580498/1660096
Use of the VIM editor