VIM Commands
Vim Commands
Commands in NORMAL modes
Motions
small granular: move by direction
k
h
l
j
mid granular: move by word
e
move onto the end of the current wordb
move onto the head of the current wordw
move onto the head of the next word
large granular: move by line
$
move onto the head char of the line0
move onto the tail char of the line
huge granular: move by paragraph
{
move onto the last blank line(
move onto the begnning of this paragraph}
&)
move onto the next blank line
extreme granular: move by file
[line number]G
move to the specific linegg
move to the first line of the fileG
move to the last line of the file
Operators
Operators make effects on the corpus when assigned to some range (defined by cursor movement or the object). Operator could be doubled to work on the current line
{Operator} + {Motions} OR {Object} = Operation
d
deletedaw
aw
for a word(defined by space)dap
ap
for a whole paragraph(defined by blank line)y
yank into registerc
changeg~
swap casegu
make lowercasegU
Make uppercase>
shift right<
shift right=
auto indent!
filter {Motion} lines through an external program
Undo Tasks
u
undo one certain operation
(one editing command in normal mode, all editing in insert mode last time)Ctrl-r
for redo one task
Special Command g
Begin Editing
into INSERT mode
i
begin inserting at current positiona
begin inserting at the next positionA
begin inserting at the end of the lineo
begin inserting at the beginning of the new line belowO
begin inserting at the beginning of the new line aboves
delete the current char & begin insertingS
delete the current line & begin inserting at the head of current lineC
delete the rest of current line & begin editing
local modification
r
character replacement (quit insert mode after one char modification)D
delete the rest of the lineJ
combine this line and the next
Copy and Paste
- 删除的文本将储存在寄存器中
- p 将寄存器的内容放在光标下方的行
f{char} find the next occurence of {char}
; repeat the last search operation
Command in INSERT modes
Delete in insert mode
Ctrl-h
BackspaceCtrl-w
delect back one wordCtrl-u
delect back to start of line