Vim command Summary

Source: Internet
Author: User

Two modes:
■ Normal mode (Normal Mode)
■ Insert mode)

In insert mode, press escape to enter normal mode. In normal mode, press I to enter insert mode.

The insert mode is used to edit text. commands are generally used in Normal Mode:

Positioning:

■ H shifts left.
■ J move down.
■ K move up.
■ L right shift
■ Pagedown (or CTL-f) rollback
■ Pageup (or CTL-B) rollback
■ G last line

■ Num Gg to row num

■ Gg's first line

Save and exit:

■ Q exit

■ Q! Force exit and do not save

■ W filename is saved to the filename File
■ WQ save and exit

Edit:

X deletes the current character.
Dd deletes the current row
DW deletes the word where the current cursor is located. For example, int word CH, the entire word can be deleted.
D $ Delete the cursor position to the end of the row.
J. Delete the linefeed at the end of the row where the current cursor is located.
When a is added at the cursor position, it is actually to move back and switch to the insert mode.
Adding a after the current row actually means moving to the end of the row to switch to the insert mode.
R char replaces the current character with a char character

R text overwrites text from the current position until you Press ESC.

Search:

Press/to enter the string to be searched. Press enter to start searching. Press n to locate the next search result.

Replace:

Press: Enter the command to perform the replacement operation.

■: S/old/new/g Replace in the current row
■: #, # S/old/new/g replace between #,# rows

■: % S/old/new/g Replace the entire file

■: % S/old/new/GC is replaced in the entire file, but a prompt is displayed.

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.