Vim Common commands

Source: Internet
Author: User

One, insert command

A specifier insert in the word cursor
A at the end of the line where the cursor is inserted
I match either insert in the word cursor
I Insert at the beginning of the cursor
o Insert a new line under the cursor
O insert a new line on the cursor

Second, positioning command

: Set Nu Sets line number
: Set Nonu Cancel line number
GG to First line
G to last line
NG to Nth row
: N to Nth row
$ move to end of line
0 move to the beginning of the line

Third, delete the command

X Delete the character at cursor location
NX Delete n characters at cursor location
DD deletes the cursor in the row
NDD Delete Cursor is located in the following n line
DG deletes the line from the cursor to the end of the file
D Delete the cursor at the end of the line
: n1,n2d deletes a specified range of rows

Iv. Copying commands

YY copy when moving forward
Nyy Copy the current n rows
DD Cut when moving forward
NDD cuts the current n rows
P paste below the current line
P paste onto the current line

V. Replacement and CANCELLATION commands

R cancels the character of the cursor
R start replacing characters from the cursor, press ESC to end
U Cancel the previous action

Vi. Search and search replacement commands

/string search for specified string, ignoring case set IC when searching
n searches for the next occurrence of the specified string
:%s/old/new/g full text Replace specified string
: N1,n2s/old/new/g replaces specified string within a certain range

Vii. Save and Exit commands

: W Save changes
: W new_filename Save as specified file
: Wq Save changes and exit
ZZ shortcut keys, save changes and exit
: q! Do not save changes and exit
: wq! Save changes and exit (read-only file owner and root can be used)

Eight, import a file to the current file

: R file Name

Nine, do not quit the execution of orders

:! Command

X. Command execution results Import the current file

: R!date

Vim Common commands

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.