Common Vim commands

Source: Internet
Author: User

The following command is used to facilitate the review of this article because it is often difficult to read books.

 

If you cannot find the vim command in this article, see Linux Private food page278.

 

Vim has three modes: general mode, edit mode, and command line mode.

In normal mode

Move command: 0/[home] move cursor to the front of this line

$/[End] move the cursor to the end of the line

G moves to the last row of the file.

Ng moves to the nth line of the file

Gg/1g move to the first line of this file

N [enter] move the cursor down n rows

DELETE command: X, X indicates to delete a character backward, and X indicates to delete a character forward.

NX deletes n consecutive characters (N is a number)

Dd deletes the row where the cursor is located.

NDD deletes n rows down where the cursor is located

D1g delete all data from the cursor to the first row

DG deletes all data from the cursor to the last row

D $ Delete the last character from the cursor to the row

D0 deletes the first character from the cursor to the row

Copy command: yy copy the row where the cursor is located

Nyy copies the n-down line of the cursor

Y1g copy all data from the row where the cursor is located to the first row

G. Copy all data from the row where the cursor is located to the last row.

Y0 copies the character of the cursor to all data at the beginning of the row.

Y $ copy all data from the character with the cursor to the end of the row

Paste command: P, P: paste the copied data under the cursor line; P: paste the copied data on the cursor line

Other commands: Restore the previous operation

[CTRL] + R redo the previous operation

In command line mode

: Set nu display row number

: Set Nonu cancel row number

 

Common Vim 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.