vi 简明手册

vi reference

 

光标控制


hLeft

 

编辑

jDown
kUp
l (or spacebar)Right
wForward one word
bBack one word
eEnd of word
(Beginning of current sentence
)Beginning of next sentence
{Beginning of current paragraph
}Beginning of next paragraph
[[Beginning of current section
]]Beginning of next sectionAAppend to end of current line
0Start of current lineiInsert before cursor
$End of current lineIInsert at beginning of line
^First non-white character of current lineoOpen line above cursor
+ or RETURNFirst character of next lineOOpen line below cursor
-First character of previous lineESCEnd of insert mode
n |character n of current lineCtrl-IInsert a tab
HTop line of current screenCtrl-TMove to next tab position
MMiddle line of current screenBackspaceMove back one character
LLast line of current screenCtrl-UDelete current line
nHn lines after top line of current screenCtrl-VQuote next character
nLn lines before last line of current screenCtrl-WMove back one word
Ctrl-FForward one screencwChange word
Ctrl-BBack one screenccChange line
Ctrl-DDown half a screenCChange from current position to end of line
Ctrl-UUp half a screenddDelete current line
Ctrl-EDisplay another line at bottom of screennddDelete n lines
Ctrl-YDisplay another line at top of screenDDelete remainer of line
z RETURNRedraw screen with cursor at topdwDelete word
z .Redraw screen with cursor in middled}Delete rest of paragraph
z -Redraw screen with cursor at bottomd^Delete back to start of line
Ctrl-LRedraw screen without re-positioningc/patDelete up to first occurance of pattern
Ctrl-RRedraw screen without re-positioningdnDelete up to next occurance of pattern
/textSearch for text (forwards)dfaDelete up to and including a on current line
/Repeat forward searchdtaDelete up to, but not including, a on current line
?textSearch for text (backwards)dLDelete up to last line on screen
?Repeat previous search backwardsdGDelete to end of file
nRepeat previous searchJJoin two lines
NRepeat previous search, but it opposite directionpInsert buffer after cursor
/text/+nGo to line n after textPInsert buffer before cursor
?text?-nGo to line n before textrxReplace character with x
%Find match of current parenthesis, brace, or bracket.RtextReplace text beginning at cursor
Ctrl-GDisplay line number of cursorsSubstitute character
nGMove cursor to line number nnsSubstitute n characters
:nMove cursor to line number nSSubstitute entire line
GMove to last line in fileuUndo last change


URestore current line

xDelete current cursor position
XDelete back one character
nXDelete previous n characters
.Repeat last change
~Reverse case
yCopy current line to new buffer
yyCopy current line
"xyyCopy current line into buffer x
"XdDelete and append into buffer x
"xpPut contents of buffer x
y]]Copy up to next section heading
yeCopy to end of word



File Handling



:wWrite file

 





 




 

 

:w!Write file (ignoring warnings)
:w! fileOverwrite file (ignoring warnings)
:wqWrite file and quit
:qQuit
:q!Quit (even if changes not saved)
:w fileWrite file as file, leaving original untouched
ZZQuit, only writing file if changed
:xQuit, only writing file if changed
:n1,n2w fileWrite lines n1 to n2 to file
:n1,n2w >> fileAppend lines n1 to n2 to file
:e file2Edit file2 (current file becomes alternate file)
:e!Reload file from disk (revert to previous saved version)
:e#Edit alternate file
%Display current filename
#Display alternate filename
:nEdit next file
:n!Edit next file (ignoring warnings)
:n filesSpecify new list of files
:r fileInsert file after cursor
:r !commandRun command, and insert output after current line


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值