Common Vi/vim Commands

Source: Internet
Author: User

Vi/vim commands are complex and powerful, and here are some of the more common commands that can be used to meet general needs.

To move the cursor:
-Shift Left: H
-Move Down: J
-Move up: K
-Shift Right: l
-page Flip: Ctrl F, CTRL b

Insert:
-Insert at cursor position: I
-Insert at end of line: a
-Insert a new line on the next line: O

Edit:
-undo Modification: U
-Replace the character where the cursor is located: r

Delete:
-delete the character of the cursor: X
-delete the remaining part of the word after the cursor: DW
-Delete the line section after the cursor: d$/d
-delete Current line: DD
-delete n rows: ndd
-line break at end of row deletion: J

Save, Exit:
-Save:: W
-Save and exit:: X/: Wq
-Exit/Forced exit:: Q/: q!

Find, replace:
-Replace string (replace all str1 with str2)::%s/str1/str2/g
-Search for a string:/str
-Search Previous, Next: N,n

Common Vi/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.