Linux Study Notes: Know VI

Source: Internet
Author: User

Common vi usage

Normal Mode
H left
J lower
K
L right
0 move to the beginning of the row
$ Move to the end of a row
H top screen
M Center
L The lowest Screen
Last line of G File
/Work downward search
? Work search up
Move gg to the first line of the file

Edit mode
A, I, r, o, A, I, R, O
Enter edit mode
Dd deletes the current row of the cursor
Ndd Delete n rows
Yy copy the current row
Nyy copies n rows
P, P Paste
U undo
[Ctrl] + r redo the previous action
[Ctrl] + z pause and exit

Command mode
: W save
: W! Force save
: Q! Do not save and exit
: Wq! Save and exit
: E! Restore original file
: W filename save
: Set nu
: Set nonu cancel row number
ZZ save and exit
: Set nohlsearch permanently disables highlight
: Sp open two documents at the same time
[Ctrl] + w two document changes
: Nohlsearch temporarily disables highlighted display

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.