00 Preface
Learning to program under Linux is the first thing to learn to use VIM, and to skillfully use vim can greatly improve the efficiency of writing code. is so-called AX, for this I refer to a few blog will be commonly used vim operation collation out, easy to access.
01 Cursor Movement 1.1 Page action
H,j,k,l
Left, down, up, right (personally feel most important)
Crtl+e
page moves down one line
Crtl+f
Go up one page
Crtl+b
Turn down one page
Crtl+u
Half PAGE Up
Crtl+d
Down Half page
1.2 Fast cursor Movement
W
Jump to the next top of a word
W
Jump to the beginning of the next word (long jump, end-of-point as a word)
E
Jump to the next end of a word
E
Skip to the next word (long jump)
B
Jump to the previous first word
B
Skip to previous word (long jump)
0
Jump to the beginning of the No. 0 character
^
Jump to the beginning of the 1th character
$
Jump to end of line
Gg
Skip to the top of the article
G
Jump to the end of the text
Ngg
Jump to Nth row
Gd
Jump to Variable definition
*
Look down the word at the cursor
#
Look up the word at the cursor
02 Delete and copy
Dd
Delete the line where the cursor is located
Dw
Delete the word where the cursor is located
Ndd
Delete N rows down
Yy
Copy cursor line to Pasteboard
yw
Copy the word of the cursor to the pasted version
P
Paste the Clipboard contents below the cursor
P
Paste the Clipboard contents onto the cursor
03 Insert Mode
I
Insert content before the cursor
I
Inserting content at the beginning of a line
A
Inserting content after the cursor
A
Inserting content at the end of a row
O
Add a line under the cursor and enter insert mode
O
Adds a line to the cursor and enters insert mode
04 Edit Mode
J
Connect the next line and the current row as one line
Cc
Delete the current row and enter edit mode
cw
Delete the current word and enter edit mode
C $
Delete the content from the current word to the end of the line and enter edit mode
S
Delete the current character and enter edit mode
S
Delete the current row and enter edit mode
Xp
Swaps the current character and the next character
U
Revoke
Crtl+r
Redo
~
Toggle Case
>>
Move the current line one unit to the right
<<
Move the current line one unit to the left
==
Automatically indent as you go forward
05 Finding and replacing
:/pattern
Query string pattern backwards
:? pattern
Forward query string pattern
N
Look down
N
Look up
:/s/old/new/g
Replace all old with new
:/S/OLD/NEW/GC
Replace all old with new and ask if you want to replace
06 Programming related
Gg=g
Auto Align
: Copen
Open window to display compilation results
:!make
Compiling the program
: SH
Execute shell Script
Gcc
Note the Bank
Use of Vim