Linux VI, VIM command Daquan

Source: Internet
Author: User
Tags exit first row

one or one-like mode: Delete, copy and paste Class command

X,x x to delete one character backwards, X to delete a character previously

NX (n represents number) Delete n characters backwards

DD Delete when forward

D Delete all characters in the current line and try to become a blank line

NDD (n represents number) deletes the lower n column of the row where the cursor is located

D1G deletes all data from the row to the first row of the cursor

DG deletes all data from the row to the last line of the cursor

YY copy cursor is in the row

Y1G all data from the row to the first row where the cursor is copied

YG all data in the row to the last row where the cursor is copied

YNJ (n for number) copy cursor line down n+1 line

DNJ (n for numbers) deletes the row n+1 the cursor

P,p p Pastes the copied data on the next line of the cursor, and p pastes the copied data on the top line of the cursor

J combines the row of the cursor with the data in the next line

U Redo Previous action (undo)

  Second, edit mode command

I,i I inserts the input text at the current cursor, I inserts the input text for the first non-null character on the line where the cursor is positioned

A,a a inserts input text for the next character at the current cursor, a for the next word entered prompt the last character in the line where the cursor is inserted

O,o O Inserts a character at the beginning of the next line of the line where the cursor is located, o to begin the insertion of characters at the beginning of the previous line of the cursor's row

R,r R is the character that replaces the cursor, R replaces the text that the cursor refers to until it exits

ESC exit, back to normal mode

  Three, Command mode

H cursor moves one character to the left

The J cursor moves down one character

K-cursor Move up one character

L The cursor moves one character to the right

Ctrl+f screen down one page

Ctrl+b screen up one page

Ctrl+d screen down half page

Ctrl+u screen up half page

+ cursor moves to the first non-null character on the next line

-The cursor moves to the first non-null character of the current line

n spaces (n for numbers) the cursor moves n characters to the right of the current line

0 (number 0) the cursor moves to the first character of the current line (can be null characters, attention and-differentiate)

$ cursor moves to the last character of the current line (can be null characters, attention and-differentiate)

The H cursor moves to the first non-null character of the line at the top of the current screen

The M-cursor moves to the first non-empty character in the most middle line of the current screen

The L cursor moves to the first non-null character of the line at the bottom of the current screen

The G cursor moves to the first non-empty character in the last line of the article

NG (n represents a number) the cursor moves to the first non-null character in the nth line of the article

n Cursor moves the first non-null character of N line down from the current line

/word find word strings after the cursor

? Word finds word strings before the cursor

: S/word1/word2/g finds word1 on the current line of the cursor and replaces it with WORD2

: N1,n2s/word1/word2/g finds word1 between line N1 and line N2 and replaces Word2

:%s/word1/word2/g the entire article to find word1 and replace it with WORD2

: W saves edited data to a hard disk file

: w [filename] saves the edited data to another file on your hard disk

: R [FileName] when editing data, read the data in another file, add the contents of the filename file to the line next to the cursor

: Wq or: x Save and exit

: Q exit, apply to unmodified files

: q! Force exit, apply to modify file without saving exit

: Set nu Display line numbers

: Set Nonu Cancel line number

: n1,n2 w [filename] Saves the contents of the N1 to the N2 line in a file named filename

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.