I just sorted out some common commands in vi.

Source: Internet
Author: User
Shift + H move the cursor to the top shift + M move the cursor to the middle shift + L move the cursor to the bottom shift + G move the cursor to the end vi filename create filename File
All three commands of I a o can be edited.
: Wq save and exit
: W save
: X save and exit
: Q! Do not save and exit
Shift-6 move cursor to line head
Shif-4 the cursor is at the end of the line
Shift + H move the cursor to the top shift + M move the cursor to the middle shift + L move the cursor to the bottom shift + G move the cursor to the end
Page up page down
U undo
Ndd delete multiple rows
. Repeat a command
Yy copy a row
P paste
: R filename copy file
/Search
// Find the escape
: S/old/new replacement
: S/old/new/g to replace a row
: % S/old/new/g replace all
: % S/old/new/gc ask to replace all
: Set nu display row number
: Set nonu undisplay row number
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.