61.html
来自「著名的linux英雄站点的文档打包」· HTML 代码 · 共 1,212 行 · 第 1/5 页
HTML
1,212 行
a (append) 由游标之後加入资料。<br>
A 由该行之末加入资料。<br>
i (insert) 由游标之前加入资料。<br>
I 由该行之首加入资料。<br>
o (open) 新增一行於该行之下供输入资料之用。<br>
O 新增一行於该行之上供输入资料之用。<br>
<br>
如何离开输入模式<br>
《ESC》 结束输入模式。<br>
<br>
..指令模式<br>
=========<br>
游标之移动<br>
h 向左移一个字元。<br>
j 向上移一个字元。<br>
k 向下移一个字元。<br>
l 向右移一个字元。<br>
0 移至该行之首<br>
$ 移至该行之末。<br>
^ 移至该行的第一个字元处。<br>
H 移至视窗的第一列。<br>
M 移至视窗的中间那列。<br>
L 移至视窗的最後一列。<br>
G 移至该档案的最後一列。<br>
+ 移至下一列的第一个字元处。<br>
- 移至上一列的第一个字元处。<br>
( 移至该句之首。 (注一)<br>
) 移至该句之末。<br>
{ 移至该段落之首。 (注二)<br>
} 移至该段落之末。<br>
nG 移至该档案的第 n 列。<br>
n+ 移至游标所在位置之後的第 n 列。<br>
n- 移至游标所在位置之前的第 n 列。<br>
<Ctrl><g> 会显示该行之行号、档案名称、档案中最末行之行号、游标<br>
所在行号占总行号之百分比。<br>
<br>
注一:句子(sentence)在vi中是指以『!』、『.』或『?』结束的一串字。<br>
注二:段落(paragraph)在vi中是指以空白行隔开的文字。<br>
<br>
..视窗的移动<br>
===========<br>
<Ctrl><f> 视窗往下卷一页。<br>
<Ctrl><b> 视窗往上卷一页。<br>
<Ctrl><d> 视窗往下卷半页。<br>
<Ctrl><u> 视窗往上卷半页。<br>
<Ctrl><e> 视窗往下卷一行。<br>
<Ctrl><y> 视窗往上卷一行。<br>
<br>
..删除、复制及修改指令介绍 (此单元较少使用)<br>
=========================<br>
d(delete)、c(change)和y(yank)这一类的指令在 vi 中的指令格式为:<br>
Operator + Scope = command<br>
(运算子) (范围)<br>
运算子:<br>
d 删除指令。删除资料,但会将删除资料复制到记忆体缓冲区。<br>
y 将资料(字组、行列、句子或段落)复制到缓冲区。<br>
p 放置(put)指令,与 d 和 y 配和使用。可将最後delete或yank的资<br>
料放置於游标所在位置之行列下。<br>
c 修改(change)指令,类似delete与insert的组和。删除一个字组、句<br>
子等之资料,并插入新键资料。<br>
<br>
范围:<br>
e 由游标所在位置至该字串的最後一个字元。<br>
w 由游标所在位置至下一个字串的第一个字元。<br>
b 由游标所在位置至前一个字串的第一个字元。<br>
$ 由游标所在位置至该行的最後一个字元。<br>
0 由游标所在位置至该行的第一个字元。<br>
) 由游标所在位置至下一个句子的第一个字元。<br>
( 由游标所在位置至该句子的第一个字元。<br>
{ 由游标所在位置至该段落的最後一个字元。<br>
} 由游标所在位置至该段落的第一个字元。<br>
<br>
整行动作<br>
dd 删除整行。<br>
D 以行为单位,删除游标後之所有字元。<br>
cc 修改整行的内容。<br>
yy yank整行,使游标所在该行复制到记忆体缓冲区。<br>
<br>
..删除与修改<br>
===========<br>
x 删除游标所在该字元。<br>
X 删除游标所在之前一字元。<br>
dd 删除游标所在该行。<br>
r 用接於此指令之後的字元取代(replace)游标所在字元。<br>
如: ra 将游标所在字元以 a 取代之。<br>
R 进入取代状态,直到《ESC》为止。<br>
s 删除游标所在之字元,并进入输入模式直到《ESC》。<br>
S 删除游标所在之该行资料,并进入输入模式直到《ESC》。<br>
<br>
..搬移与复制<br>
==========<br>
利用 delete 及 put 指令可完成资料搬移之目的。<br>
利用 yank 及 put 指令可完成资料复制之目的。<br>
yank 和 delete 可将指定的资料复制到记忆体缓冲区,而藉由 put 指令<br>
可将缓冲区内的资料复制到萤幕上。<br>
例:<br>
搬移一行 .在该行执行 dd<br>
.游标移至目的地<br>
.执行 p<br>
复制一行 .在该行执行 yy<br>
.游标移至目的地<br>
.执行 p<br>
<br>
..指令重复<br>
=========<br>
在指令模式中,可在指令前面加入一数字 n,则此指令动作会重复执行 n<br>
次。<br>
例:<br>
删除10行 .10dd<br>
复制10行 .10yy<br>
.游标移至目的地<br>
.p<br>
指标往下移10行 .10j<br>
<br>
..取消前一动作(Undo)<br>
===================<br>
即复原执行上一指令前的内容。<br>
<br>
u 恢复最後一个指令之前的结果。<br>
U 恢复游标该行之所有改变。<br>
<br>
..搜寻<br>
=====<br>
在vi中可搜寻某一字串,使游标移至该处。<br>
<br>
/字串 往游标之後寻找该字串。<br>
?字串 往游标之前寻找该字串。<br>
n 往下继续寻找下一个相同的字串。<br>
N 往上继续寻找下一个相同的字串。<br>
<br>
..资料的连接<br>
===========<br>
J 句子的连接。将游标所在之下一行连接至游标该行的後面。<br>
<br>
若某行资料太长亦可将其分成两行,只要将游标移至分开点,进入输入模式<br>
(可利用 a、i等指令)再按《Enter》即可。<br>
<br>
..环境的设定<br>
===========<br>
:set nu 设定资料的行号。<br>
:set nonu 取消行号设定。<br>
:set ai 自动内缩。<br>
:set noai 取消自动内缩。<br>
<br>
自动内缩(automatic indentation)<br>
在编辑文件或程式时,有时会遇到需要内缩的状况,『:set ai』即提供自<br>
动内缩的功能,用下例解释之:<br>
.vi test<br>
.(进入编辑视窗後)<br>
this is the test for auto indent<br>
《Tab》start indent ← :set ai (设自动内缩)<br>
《Tab》data<br>
《Tab》data<br>
《Tab》data ← :set noai (取消自动内缩)<br>
the end of auto indent.<br>
.注:<Ctrl><d> 可删除《Tab》字元。<br>
<br>
..ex指令<br>
=======<br>
读写资料<br>
:w 将缓冲区的资料写入磁碟中。<br>
:10,20w test 将第10行至第20行的资料写入test档案。<br>
:10,20w>>test 将第10行至第20行的资料加在test档案之後。<br>
:r test 将test档案的资料读入编辑缓冲区的最後。<br>
<br>
删除、复制及搬移<br>
:10,20d 删除第10行至第20行的资料。<br>
:10d 删除第10行的资料。<br>
:%d 删除整个编辑缓冲区。<br>
:10,20co30 将第10行至第20行的资料复制至第30行之後。<br>
:10,20mo30 将第10行至第20行的资料搬移至第30行之後。<br>
<br>
字串搜寻与取代<br>
s(substitute)指令可搜寻某行列范围。<br>
g(global)指令则可搜寻整个编辑缓冲区的资料。<br>
s指令以第一个满足该条件的字串为其取代的对象,若该行有数个满足该条<br>
件的字串,也仅能取代第一个,若想取代所有的字串则需加上g参数。<br>
:1,$s/old/new/g 将档案中所有的『old』改成『new』。<br>
:10,20s/^/ / 将第10行至第20行资料的最前面插入5个空白。<br>
:%s/old/new/g 将编辑缓冲区中所有的『old』改成『new』。<br>
<br>
..恢复编辑时被中断的档案<br>
=======================<br>
在编辑过程中,若系统当掉或连线中断,而缓冲区的资料并还未<br>
被写回磁碟时,当再度回到系统,执行下列指令即可回复中断前<br>
的档案内容。<br>
%vi -r filename<br>
<br>
..编辑多个档案<br>
=============<br>
vi亦提供同时编辑多个档案的功能,方法如下:<br>
%vi file1 file2 ..<br>
<br>
当第一个档案编修完成後,可利用『:w』将该缓冲区存档,而後<br>
再利用 『:n』载入下一个档案。<br>
</FONT><br>
</TD>
</TR>
<TR>
<TD colSpan=2><FONT
class=middlefont></FONT><BR>
<FONT
class=normalfont>全文结束</FONT> </TD>
</TR>
<TR>
<TD background="images/dot.gif" tppabs="http://www.linuxhero.com/docs/images/dot.gif" colSpan=2
height=10></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></DIV></TD>
<TD vAlign=top width="20%"
background="images/line.gif" tppabs="http://www.linuxhero.com/docs/images/line.gif" rowSpan=2>
<DIV align=center>
<table class=tableoutline cellspacing=1 cellpadding=4
width="100%" align=center border=0>
<tr class=firstalt>
<td noWrap background="images/bgline.gif" tppabs="http://www.linuxhero.com/docs/images/bgline.gif" colspan=2 height=21>
<font class=normalfont><b>所有分类</b></font></td>
</tr>
<tr class=secondalt> <td noWrap width=27%> <font class=normalfont>1:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type1.html" tppabs="http://www.linuxhero.com/docs/type1.html">非技术类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>2:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type2.html" tppabs="http://www.linuxhero.com/docs/type2.html">基础知识</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>3:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type3.html" tppabs="http://www.linuxhero.com/docs/type3.html">指令大全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>4:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type4.html" tppabs="http://www.linuxhero.com/docs/type4.html">shell</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>5:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type5.html" tppabs="http://www.linuxhero.com/docs/type5.html">安装启动</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>6:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type6.html" tppabs="http://www.linuxhero.com/docs/type6.html">xwindow</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>7:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type7.html" tppabs="http://www.linuxhero.com/docs/type7.html">kde</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>8:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type8.html" tppabs="http://www.linuxhero.com/docs/type8.html">gnome</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>9:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type9.html" tppabs="http://www.linuxhero.com/docs/type9.html">输入法类</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>10:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type10.html" tppabs="http://www.linuxhero.com/docs/type10.html">美化汉化</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>11:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type11.html" tppabs="http://www.linuxhero.com/docs/type11.html">网络配置</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>12:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type12.html" tppabs="http://www.linuxhero.com/docs/type12.html">存储备份</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>13:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type13.html" tppabs="http://www.linuxhero.com/docs/type13.html">杂项工具</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>14:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type14.html" tppabs="http://www.linuxhero.com/docs/type14.html">编程技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>15:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type15.html" tppabs="http://www.linuxhero.com/docs/type15.html">网络安全</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>16:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type16.html" tppabs="http://www.linuxhero.com/docs/type16.html">内核技术</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>17:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type17.html" tppabs="http://www.linuxhero.com/docs/type17.html">速度优化</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>18:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type18.html" tppabs="http://www.linuxhero.com/docs/type18.html">apache</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>19:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type19.html" tppabs="http://www.linuxhero.com/docs/type19.html">email</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>20:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type20.html" tppabs="http://www.linuxhero.com/docs/type20.html">ftp服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>21:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type21.html" tppabs="http://www.linuxhero.com/docs/type21.html">cvs服务</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>22:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type22.html" tppabs="http://www.linuxhero.com/docs/type22.html">代理服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>23:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type23.html" tppabs="http://www.linuxhero.com/docs/type23.html">samba</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>24:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type24.html" tppabs="http://www.linuxhero.com/docs/type24.html">域名服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>25:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type25.html" tppabs="http://www.linuxhero.com/docs/type25.html">网络过滤</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>26:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type26.html" tppabs="http://www.linuxhero.com/docs/type26.html">其他服务</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>27:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type27.html" tppabs="http://www.linuxhero.com/docs/type27.html">nfs</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>28:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type28.html" tppabs="http://www.linuxhero.com/docs/type28.html">oracle</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>29:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type29.html" tppabs="http://www.linuxhero.com/docs/type29.html">dhcp</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>30:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type30.html" tppabs="http://www.linuxhero.com/docs/type30.html">mysql</a></font></td> </tr> </table></td></tr><tr class=secondalt> <td noWrap width=27%> <font class=normalfont>31:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type31.html" tppabs="http://www.linuxhero.com/docs/type31.html">php</a></font></td> </tr> </table></td></tr><tr class=firstalt> <td noWrap width=27%> <font class=normalfont>32:</font> </td><td noWrap width=73%> <table width=100% border=0> <tr> <td><font class=normalfont><a href="type32.html" tppabs="http://www.linuxhero.com/docs/type32.html">ldap</a></font></td> </tr> </table></td></tr> </table>
</DIV></TD></TR>
<TR vAlign=top>
<TD width="80%">
<DIV align=center><BR>
</DIV>
</TD></TR></TBODY></TABLE></TD></TR>
</TABLE></TD></TR>
</TABLE>
<TABLE cellSpacing=0 cellPadding=4 width="100%" bgColor=#eeeeee
border=0><TBODY>
<TR>
<TD width="50%">
<P><FONT class=middlefont>版权所有 © 2004 <A
href="mailto:bjchenxu@sina.com">linux知识宝库</A><BR>
违者必究. </FONT></P>
</TD>
<TD width="50%">
<DIV align=right><FONT class=middlefont>Powered by: <A
href="mailto:bjchenxu@sina.com">Linux知识宝库</A> Version 0.9.0 </FONT></DIV>
</TD></TR></TBODY></TABLE>
<CENTER></CENTER></TD></TR>
</TABLE></CENTER></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?