The basic use of VIM

Source: Internet
Author: User

The common use of VI
1. General mode
Ctrl+f Move Down one page
Ctrl+b Move up one page
Ctrl+d Move Down half a page
Ctrl+u move up half a page
N[enter] cursor down n line, n for number, Enter for key
NG moves to the nth row of the file
G move to the last line of the file
DD Delete the line that the cursor is on
NDD Delete the n rows under the cursor
YY Copy the line selected by the cursor
P,p Paste the copied line
YG copies the contents of the cursor to the last line
NYY copy cursor down n rows
X Remove one character backwards
NX removes n characters backwards
DD Delete the line where the cursor is located
NDD Delete the n rows under the cursor


20,50S/MAN/MAN/GC the man from 20 to 50 rows into man (replace with man (y/n/a/q/l/^e/^y)? Indicates whether to change the question)


2. Edit mode
I enter insert mode
Save and leave the command
: Set NU Displays line numbers in front
: Set Nonu cancels the line number shown earlier
: Wq Exit Edit
: w [FileName] writes edited data to another file
: R [FileName] reads another file into the back appended
: n1,n2 w [filename] reads files n1 to N2 into another file
: q! Leave no storage

The basic use of VIM

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.