VI Operation Small Summary

Source: Internet
Author: User

Open File
vi [file name];

Roll forward half Screen
Ctrl + u

Half-screen after rolling
Ctrl + D

Roll forward one screen
Ctrl + b

Roll back one screen
Ctrl + F

Line n roll to top of screen
nz

Move the cursor one cell to the right
??
L
Space

Move the cursor left one cell
??
H
Backspace

Move Cursor up
??
K
Ctrl + P

Move Cursor Down
??
J
Ctrl + N

Move the cursor right one word to the beginning of the word
W
W

Move the cursor left one word to the beginning of the word
B
B

Move the cursor right one word to the end of the word
E
E

Move cursor to end of sentence
)

Cursor moves to the beginning of a sentence
(

Move the cursor to the beginning of the paragraph
}

Move cursor to end of paragraph
{

Move the cursor down n rows
n+

Move the cursor up n rows
N-

The cursor moves to the beginning of nth
NG

The cursor moves to the end of the nth line
n$

Move the cursor to the top of the screen
H

Move the cursor to the middle of the screen
M

The cursor moves to the last line of the screen
L

Cursor moves to the beginning of the current line
0

Delete the n-1 characters at the beginning and after the cursor
Ndw
NdW

Delete to the beginning of the line
Do

Delete to end of line
d$:

Delete the current line and its subsequent n-1 rows
Ndd


Delete a character after the cursor
X

Delete a character before the cursor
X

Delete the text entered under input mode
Ctrl + u

Delete a row
Dd

Search for pattern backwards from the cursor
/pattern

Search the pattern forward from the cursor
? pattern

Repeat the search in the same direction
N

Repeat the search in the opposite direction
N

Replaces all P1 in the current row with P2
: s/p1/p2/g

Replace all P1 in line N1 to N2 with P2
: n1,n2s/p1/p2/g

Replace all P1 in the file with P2
: g/p1/s//p2/g

Copy the contents of the N1 line to the N2 line to line N3
: N1,N2 CO n3

Move the contents of the N1 line to the N2 line down to line N3
: n1,n2 m N3

Delete the contents of N1 rows to N2 rows
: N1,n2 D

Save current file
: W

Save the current file and exit
: X

Exit VI
: Q

Do not save the file and Exit VI
: q!

Insert text match either the current character
I

Inserting text at the beginning of a line
I

Add text after the current character
A

Add text at the end of a row
A

Insert a blank line after the current line
O

Insert a blank line before the current line
O

Enter text in a rewritten manner
R

VI Operation Small Summary

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.