Vim Common directives

Source: Internet
Author: User

vim is not a long time to use, but it is now inseparable from the familiar vim editing mode. Vim 's learning curve is very steep, at the beginning of learning, the face of a lot of operational commands to remember, often deterred.

In fact, just remember some of the commonly used commands, coupled with the use of Vim in the work of editing, will soon be handy.

# # #光标移动 (Cursor movement)

Command function (explanation)
h,j,k,l hIndicates to the left, j indicating downward, to the k right, to the l upper
Ctrl+f Previous page
Ctrl+b Next page
weW,E Jumps to the back of the word, lowercase includes punctuation
b,B Jump cursor forward in words, lowercase with punctuation
O Open a new line
^ Start of a line
$ End of Line
gg The first line of the document
[N]G The nth or last line of the document

# # #插入模式 (Insert Mode)

Command function (explanation)
i Insert to front of cursor
I Insert to start of line
a Insert to the back of the cursor
A Insert to last position of line
o,O Open a new line
Esc Turn off insert mode

# # #编辑 (Editing)

Command function (explanation)
r Replaces one character in the insertion mode with the cursor
J Merge next line to previous line
s Deletes the cursor's character, and the cursor is still in line
S Delete the row where the cursor is located, and the cursor is still in line, unlikedd
u Undo previous Action
ctrl+r Redo the previous action
. Repeat the last command
~ Transform to uppercase
[N]>> A row or n line moves to the right one tab
[N]<< Move one tab to the left of a row or n line

# # #关闭 (Exiting)

Command function (explanation)
:w Save
:wq,:x Save and close
:q Off (Saved)
:q! Force Close

# # #搜索 (Search)

Command function (explanation)
/pattern Search (non-insert mode)
?pattern Search backwards
n The cursor reaches the previous target of the search result
N The cursor reaches the next target of the search result

# # #视觉模式 (Visual Mode)

Command function (explanation)
v Select one or more characters
V Select a row

# # #剪切和复制 (Cut and Paste)

Command function (explanation)
dd Delete a row
dw Delete a word
x Delete a character after
X Delete the previous character
D Delete the last character of a line
[N]yy Copy one row or n rows
yw Copy a Word
p Paste

# # #窗口操作

Command function (explanation)
:split Split a window horizontally
:vsplit Split a window vertically
:close Close window
Ctrl+W Switch window, to the h left window, j to the bottom window, k to the upper window, l to the right window

Vim Common directives

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.