Record several commands that vim often uses

Source: Internet
Author: User

Tags: line number blog Strong edit delete move write inux processing

Vi/vim Basic Use Method
The VI Editor is the standard editor for all UNIX and Linux systems.


$ vim 1.txt

Open a file with VI directly into the general mode (this is the default mode). In this mode, you can use the left and right buttons to move the cursor, you can use the deletion of characters or delete the entire line to process the contents of the file, you can also use copy, paste to process your file data. You can now use several commands to find and replace
"/word" looks down at the cursor for a string called word
"word" looks up a string with a name called Word to the cursor
"N" represents the action of repeating the previous lookup
"N" is exactly the opposite of N and a find action for "reverse" before the line

Find characters after search Inode highlighted, input: Nohl can cancel highlighting

: Set NU Display line number: Set Nonu suppress line number

Delete, copy, and paste

"DD" deletes the cursor in the row
"NDD" Removes the downward n-line of the cursor
"D1G" removes all data from the line to the first row of the cursor
"DG" removes all data from the last row of the cursor

"YY" the line where the cursor is copied
"Nyy" Copy the Down n column where the cursor is located

"P" Pastes the copied data on the next line of the cursor with "P" on the previous line of the cursor

"U" restores the previous operation

Insert mode

Pressing A or I will enter the write mode, at which time the text can be entered.

Exit and save the file

Press ESC and then enter

: w (write)

: wq (input "wq", save and Exit VI)

: q! (Enter q!, do not save the mandatory exit VI)

Record several commands that vim often uses

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.

Tags Index: