Vim 常用命令

普通编辑命令

复制

Cut and Paste

删除 delete

撤销

Insert Mode

click to edit

模式

可视模式

视行模式

插入模式

替换模式

正常模式

可以使用快捷键命令

可以输入文本,在正常模式下,按 i、a、o 等都可以进入插入模式。

正常模式下按 v 进入,移动光标可以选择文本

正常模式下按 V 进入, 总是整行整行的选中

正常模式下,按R进入

a - append after the cursor

click to edit

click to edit

I - insert at the beginning of the line

A - append at the end of the line

i - start insert mode at cursor

o - open (append) blank line below current line

O - open blank line above current line

Cursor movement

e - jump to end of words (punctuation considered words)

E - jump to end of words (no punctuation)

W - jump by words (spaces separate words)

b - jump backward by words (punctuation considered words)

w - jump by start of words (punctuation considered words)

B - jump backward by words (no punctuation)

l - move right

0 - (zero) start of line

k - move up

^ - first non-blank character of line

j - move down

$ - end of line

h - move left

G - jump to last line of file

yy - yank (copy) a line

2yy - yank 2 lines

yw - yank word

y$ - yank to end of line

p - put (paste) the clipboard after cursor

P - put (paste) before cursor

dd - delete (cut) a line

dw - delete (cut) the current word

x - delete (cut) current character

u - undo

U 撤销对整行的操作

Ctrl + r - Redo

x:delete (cut) current character

X:删除光标前一个字符

dd:删除光标所在的行

D:删除当前行光标位置到行尾的字符

J:删除光标所在行的换行符

gg - jump to first character of file

f{char} - to the Nth occurrence of {char} to the right

F{char} - to the Nth occurrence of {char} to the left

t{char} - till before the Nth occurrence of {char} to the right

T{char} - till before the Nth occurrence of {char} to the left