Three main modes of VIM:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/46/2E/wKiom1PuDX7RHRFMAAByoGcjYOY252.jpg "title=" Clipboard1.png "alt=" Wkiom1pudx7rhrfmaabyogcjyoy252.jpg "/>
Open file: Vim a.txt: Creates a new file if A.txt does not exist but does not exist if you exit without saving
Mode conversion:
Command mode: initial default mode
Press ESC in any mode to always return to command mode
Switch from command mode to insert mode: Press I or the Insert key, press A to enter insert mode and move the cursor to the end of a line, I enter insert mode and move the cursor to the front of the line, O on the next line to a new line and into insert mode, o Start a new line on the previous line and enter insert mode
Save exit: (in command mode)
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/46/2E/wKiom1PuDY2QwwkyAABGjSyg5vU084.jpg "title=" Clipboard2.png "alt=" Wkiom1pudy2qwwkyaabgjsyg5vu084.jpg "/>
Note: x equals: Wq; read-only file administrators can use: wq! to force save
Command mode operation:
First press the number and then press the arrow key: Left, n characters to the right
Home: Move to the beginning of the line
End: Move to end of line
Pageup,pagedown: Page flipping
If the arrow keys cannot move the cursor, use h,j,k,l to move
W,b Move in Word units
), (move in periods
},{Moving in segments
G: Move to the end of the file
: 200 move to 200 rows
: Set Nu: Add line number
: 1,5s/dog/cat: Replace the dot of the line with the cat
:%s/dog/cat/gi: Global replacement dot for cat
CC: Replace one line (delete this line and go to insert mode)
DD: Cut or delete, 10DD cut to 10 lines
P: Paste the next line in the cursor position
P: Paste on the previous line of the cursor
YY: Copy, 10yy for copy 10 lines
U: Undo One operation
U: Disposable Recovery
Ctrl+r: Undo, and restore the opposite
Press V to enter VI editor mode in less a.txt browse mode, press: Q Back to less browse mode
Visual mode:
Press V, multiple selection, in character units
Press V, multi-Select, in Behavior unit
Open multiple windows for a file at the same time:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/46/2E/wKiom1PuDZuiSj_pAABg4NPI-zc764.jpg "title=" Clipboard3.png "alt=" Wkiom1pudzuisj_paabg4npi-zc764.jpg "/>
Alias
aliases, such as Alias Vi=vim
or vim. BASHRC to be modified, in each user's home directory has
Vim. Viminfo:vim Editor History
This article is from the "FLYCLC" blog, make sure to keep this source http://flyclc.blog.51cto.com/1385758/1540842