Vim commands that are commonly used

Source: Internet
Author: User

are all moving in command mode:

J----> Down

K----> Up

L----> right

H----> Left

Save:

W----> Save

Exit:

Q----> Exit

Q!---> do not save forced exit

Positioning:

Number, G: Quickly navigate to the beginning of a line

G----> Navigate directly to the beginning of the last line of the file

1G, or GG----> Quick position to First line

Delete command:

X: Delete one character after cursor

X: Delete one character before cursor

DD: Cut, delete when moving forward

Number, DD: Deletes the n rows at the beginning of the current line, including the forward

D: Delete all contents of the line after the cursor, including the character of the cursor

D0: Delete all contents of the line before the cursor, not including the character of the cursor

Undo command:

U: Step-by-step undo

Ctr-r: Anti-revocation

Text line movement:

>>: Text line moves right

<<: Text line shift left

Start line, end line: Indent to the right, how many, how many times to indent

Start line, end line <: Indent to the left, how many <, and how many times to indent

Copy and paste:

YY: Copy when moving forward

Number, yy: Copy n rows

P: Open a new line at the cursor position, paste

DD: Cut, delete when moving forward

Replace:

R: The character of the cursor is in the replaced state

%s/main/main/g: Replace main with main,% for all, can be replaced by 5, 15, indicating the number of rows

Find:

/: Enter the query status, enter the content you want to find

N: Look down

N: Find up

The command mode changes to edit mode:

I----> Insert a character before the cursor

A----> Insert a character after the cursor

I----> Insert the beginning of the line

A----> Insert end of Line

o----> Down new line, insert beginning

O----> Open a new line, insert beginning

Vim commands that are commonly used

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.