vi编辑器功能键一览表
Basics/Loading/Saving
Switch to command mode
:e Load file
:e! Revert to last saved state
:w Save changes
:w Save changes as file
WARNING: you are still
editing the old file, to edit the
newly saved type :e
afterwards
:q Quit if saved
:q! Quit without saving
:...
Basics/Loading/Saving
Switch to command mode
:e Load file
:e! Revert to last saved state
:w Save changes
:w Save changes as file
WARNING: you are still
editing the old file, to edit the
newly saved type :e
afterwards
:q Quit if saved
:q! Quit without saving
:wq Save and quit
ZZ Save and quit
Misc commands
Repeat command c n-times
u Undo
v Start highlighting
Basic movement
h Move cursor left
j Move cursor down
k Move cursor up
l Move cursor right
w Move cursor to next word
b Move cursor to previous word
{ Move cursor to start of
previous or current paragraph
} Move cursor to start of next
paragraph
( Move cursor to start of
previous or current sentence
) Move cursor to start of next
sentence
^ Move cursor to start of line
$ Move cursor to end of line
Ctrl+F Move down one screen
Crtl+B Move up one screen
Ctrl+D Move down ½ screen
Ctrl+U Move up ½ screen
% Jump to corresponding bracket
Advanced movement
G Jump to end of file
G Jump to line n
gg Jump to start of file
Basic input
i Insert at cursor position
I Insert at start of line
a Append after cursor position
A Append at end of line
o Start new line after current line
O Start new line before current
line
Indention
>> Indent in command mode
<< Exdent in command mode
Ctrl+T Indent in insert mode
Ctrl+D Exdent in insert mode
Basic editing
y Copy from cursor to position equivalent
to command c (yh copies character left
to cursor, y} copies from cursor to end
of paragraph)
yy Copy line
d Cut, like y
dd Cut line
D Cut to end of line
x Cut current character
X Cut to start of line
p Paste at cursor position
P Paste after cursor position
Advanced editing
:r Inserts the content of file
:r! Inserts the output of the
shell command sys
:abbr
Abbreviation for insert
mode: after having typed
the abbreviation a followed
by a space or dot/colon/...,
text is inserted
:map
Map commands to a;
and
expand
to those keys
Switches
:set ic Ignore case
:set noic Don't ignore case
:set ai AutoIndent
:set noai Don't AutoIndent
:syntax
on/off
Syntax highlighting
:set
fileformat=
unix/dos
Switch UNIX/DOS
linebreaking
Ranges
4,7 Lines 4 to 7
4;7 Line 4 and the 7 following
lines
4,$ Line 4 up to the last line
4,. Line 4 up to current cursor line
.,2000 Current cursor line to line 2000
-3,+4 From three lines above current cursor
position to four lines after current
cursor position
+4,$-3 From four lines after current cursor
position to three lines before last line
/word/,$ Form next occurance of word
to last line
: Apply command c to a range
Searching/Replacing
/text Search forward for text
/ Repeat last search forward
?text Search backward for text
? Repeat last search backward
n Repeat last search in last
direction
N Repeat last search in opposite
direction
:s Regular Expression Replacing
:g/text/ Execute command c in every
line containing text
:g!/text/ Execute command c in every
line NOT containing text
本文档为【vi编辑器功能键一览表】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。