Vi Editing Mode

keeking發表於2012-07-10

What to Type

Result

a

append after the cursor

i

insert before the cursor

IText inserted at beginning of line
AText inserted at end of line
RText overwrites existing text

What to Type

Result

x

deletes the character the cursor is under

dd

deletes the line the cursor is on

DEquivalent to d$ (delete to end of line)
ddEquivalent to 0d$ (delete entire line)
CEquivalent to c$ (delete to end of line, enter input mode)
ccEquivalent to 0c$ (delete entire line, enter input mode)
XEquivalent to dh (delete character backwards)
xEquivalent to dl (delete character forwards)

What to Type

Result

j

moves the cursor up one line

k

moves the cursor down one line

h

moves the cursor backwards on a line

l

moves the cursor forward on a line


What to Type

Result

:wq

saves the current changes and exits vi

:w!

saves the current changes but does not exit vi

:q!

exits vi without saving any change

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7899089/viewspace-735085/,如需轉載,請註明出處,否則將追究法律責任。