Vim 命令

MODE

  • Command mode
  • Insert mode
  • Last line mode

Mode Transform

  Command mode ---> Insert mode: i,a,o,I,A,O
  i: Insert characters before the cursor(光标)
  a: Insert characters after the cursor
  o: Insert characters from the next line
  I: Insert characters from the beginning of a line
  A: Insert characters from the last of a line
  O: Insert characters from the previous line
  Command mode ---> Last line mode: :
  Insert mode/Last line mode --->Command mode: Esc

Orders

Command mode

yy: copy the line
p: paste
dd: delete/cut the line
D: delete/cut the cursor and subsequent(后来的) contents 
d0: delete/cut the before contents of the cursor  
dw: delete/cut the word
x: delete the cursor ->(删除方向)
X: delete the cursor <-(删除方向)
u: undo order
.: redo before order
v/V: select multiple lines of code(需配合方向键)
>>: move to the right(右移代码)
<<: move to the left(左移代码)
}: move to the before paragraph
{: move to the next paragraph
nyy: copy n lines, n is a number
ndd: delete/cut n lines, n is a number
Ctrl+f: pageup
Ctrl+b: pageon
Ctrl+r: undo undo (反撤销)
nG: go to line n, n is a number
G: go to the last line
gg: go to the first line
w: go to the beginning of the next character
b: go to the beginning of the previous character
------------------------------------------------------------------
r: replace a character
R: replace multiple characters
h: lift <- 
j: up 
k: on 
l: right ->
M: the middle of the current screen
L: the bottom of the current screen
H: the top of the current screen
/: search
n: search up(查找下一个搜索值)
N: search on(查找上一个搜索值) 
Shift+ZZ: save and quit

Last line mode

w: save
q: quit
wq: save and quit

%s/abc/123/g: replace		
usage: %s/原内容/新内容/g

n1,n2s/abc/123/g: replace the contents between line n1 and n2 	       usage: 起始行,结束行s/原内容/新内容/g

!: enforce(强制执行)
usage: q!(强制退出)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值