VI 命令大全(linux 编辑器VI 的常用命令)

VIM (VI Improved) 是 linux 最常见的编辑器之一,功能强大 ,但最让人头疼的也是它的复杂的命令。

这篇文档提供了 VIM 常见的命令的使用:

File and window commands

:e filename open a new file
:e! filename open a new file without saving the current one
:w filename write buffer to file
:w! filename write buffer to an existing file
:r filename read file to buffer
:new split window and load an empty file
:split split window
:new filename open file in a sub window
Ctrlww Jump to next window
:n Edit the next file

Moving by text objects

h move the cursor one position left
j move the cursor one position down
k move the cursor one position up
l move the cursor one position right
w move cursor forward to first character of next word
e move cursor forward to last character of next word
b move cursor backward to first character of previous word
W same as w; ignore punctuation
E same as e; ignore punctuation
B same as b; ignore punctuation
) move forward to next sentence beginning
( move backward to previous sentence beginning
} move forward to next paragraph beginning
{ move backward to previous paragraph beginning

Move to absolute position in a line

0 move cursor to beginning of current line
$ move cursor to end of current line
^ move cursor to first non-space/tab in current line

Move to absolute position in the file

G jump to the end of the file
gg jump to the beginning of the file
1G jump to the beginning of the file
nG jump to nth line
:n jump to nth line

Move by screen

Ctrlf move cursor forward by one screen
Ctrlb move cursor backward by one screen

Move to absolute position on the screen

H move cursor to top line
M move cursor to middle line
L move cursor to last line

Other

 move cursor to previous position
x mover cursor to marker x, where x is a letter from a to z
% move cursor to the match of a parethesis, bracket or brace
SPACE move cursor one position right
ENTER move cursor to beginning of next line

 

更多命令,请参考: VIM commands  这篇文档。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值