VIM keyboard shortcuts

List of shortcut keys
ShortcutCommandHow useful(?)
Cursor movement                                                                                                                                         VIM
hmove left+       –
jmove down+       –
kmove up+       –
lmove right+       –
wjump by start of words (punctuation considered words)+       –
Wjump by words (spaces separate words)+       –
ejump to end of words (punctuation considered words)+       –
Ejump to end of words (no punctuation)+       –
bjump backward by words (punctuation considered words)+       –
Bjump backward by words (no punctuation)+       –
0(zero) start of line+       –
^first non-blank character of line+       –
$end of line+       –
GGo To command (prefix with number+       –
Note:Prefix a cursor movement command with a number to repeat it. For example, 4j moves down 4 lines.+       –
Insert ModeInserting/Appending text+       –
istart insert mode at cursor+       –
Iinsert at the beginning of the line+       –
aappend after the cursor+       –
 
Aappend at the end of the line+       –
oopen (append) blank line below current line (no need to press return)+       –
Oopen blank line above current line+       –
eaappend at end of word+       –
Escexit insert mode+       –
 
Editing

VIM

rreplace a single character (does not use insert mode)+       –
Jjoin line below to the current one+       –
ccchange (replace) an entire line+       –
cwchange (replace) to the end of word+       –
c$change (replace) to the end of line+       –
sdelete character at cursor and subsitute text+       –
Sdelete line at cursor and substitute text (same as cc)+       –
xptranspose two letters (delete and paste, technically)+       –
uundo+       –
.repeat last command+       –
 
Marking text (visual mode)

VIM

vstart visual mode, mark lines, then do command (such as y-yank)+       –
Vstart Linewise visual mode+       –
omove to other end of marked area+       –
Ctrl+vstart visual block mode+       –
Omove to Other corner of block+       –
awmark a word+       –
aba () block (with braces)+       –
aBa {} block (with brackets)+       –
ibinner () block+       –
iBinner {} block+       –
Escexit visual mode+       –
 
Visual commands

VIM

>shift right+       –
<shift left+       –
yyank (copy) marked text+       –
ddelete marked text+       –
~switch case+       –
 
Cut and Paste

VIM

yyyank (copy) a line+       –
2yyyank 2 lines+       –
ywyank word+       –
y$yank to end of line+       –
pput (paste) the clipboard after cursor+       –
Pput (paste) before cursor+       –
dddelete (cut) a line+       –
dwdelete (cut) the current word+       –
xdelete (cut) current character+       –
 
Exiting

VIM

:wwrite (save) the file, but don't exit+       –
:wqwrite (save) and quit+       –
:qquit (fails if anything has changed)+       –
:q!quit and throw away changes+       –
 
Search/Replace

VIM

/patternsearch for pattern+       –
?patternsearch backward for pattern+       –
nrepeat search in same direction+       –
Nrepeat search in opposite direction+       –
:%s/old/new/greplace all old with new throughout file+       –
:%s/old/new/gcreplace all old with new throughout file with confirmations+       –
 
Working with multiple files

VIM

:e filenameEdit a file in a new buffer+       –
:bnext (or :bn)go to next buffer+       –
:bprev (of :bp)go to previous buffer+       –
:bddelete a buffer (close a file)+       –
:sp filenameOpen a file in a new buffer and split window+       –
ctrl+wsSplit windows+       –
ctrl+wwswitch between windows+       –
ctrl+wqQuit a window+       –
ctrl+wvSplit windows vertically+       –

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值