vi 编辑命令

命令

Summary: movement keys

Here's a recap of the movement keys we just discussed, and a few extras.

Spacebar

advance the cursor one position

^B

page backward

^D

scroll down

^E

expose a line at the bottom of the screen

^F

page forward

^G

Positional status check

^N

next line, same column

^P

previous line, same column

^U

scroll up

^Y

expose a line at the top of the screen

+

next line, at the first non-whitespace character

-

previous line, at the first non-whitespace character

/string

Scan forward for string. If no string is specified, scans for the last string scanned for.

?

Scan backwards for string. If no string is specified, scans for the last string scanned for.

B

backwards one word, ignoring punctuation

linenumberG

Go to specified linenumber (an integer). Defaults to the last line.

H

move cursor to first line of screen

M

middle line of screen

L

last line of screen

W

forward a word, ignoring punctuation

b

backwards a word

e

end of current word

n

next instance of / or ? search pattern

w

next word

Summary: making changes

SPACE

Advance the cursor one position.

^W

Erase a word during insert.

.

Repeats the last change command.

O

Opens and inputs a new line, above the current line.

U

Undoes the changes you made to the current line.

a

Appends text after the cursor.

c

Changes the object you specify to the text you type in after.

d

Deletes the object that you specify.

i

Inserts text before the cursor.

o

Opens and inputs new lines, below the current line.

u

Undoes the last change.

Summary of moving and rearranging text

^

First non-whitespace character on line.

0

Beginning of the line.

$

End of the line.

)

Forward to next sentence break.

(

Backward to previous sentence break.

}

Forward to next paragraph break.

{

Backward to previous paragraph break.

]]

Forward to next section break.

[[

Backward to previous section break.

fx

Find character x forward in the line.

Fx

Find character x backward in the line.

p

Paste text after cursor.

P

Paste text before cursor.

y

Yank.

Y

Yank a whole line.

t

Forward to character x, for operations.

Tx

Back to character x, for operations.

参考

  • Linux Vi Command Help and Examples (computerhope.com)

你可能感兴趣的:(vi,工具)