Warning: Undefined array key "cperpage" in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 230

Warning: Undefined variable $output in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 300

Warning: Undefined variable $fixed_tags in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 301

Warning: Undefined variable $isshowdots in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 302

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 305

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 308

Warning: Undefined variable $tag_aditional in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 311

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $post in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Attempt to read property "ID" on null in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320

Warning: Undefined variable $more_text_link in /www/wwwroot/www.now163.com/wp-content/themes/typology/functions.php on line 320
vi常用快捷键 – 理想社会

vi常用快捷键

v

进入编辑模式:
i 插入:在目前的游标所在处插入输入之文字,已存在的文字会向后退;
a 增加:由目前游标所在的下一个字开始输入,已存在的文字会向后退:
o 插入新的一行:从游标所在的下一行枝行首开始输入文字;
r 取代:会取代游标所在的那一个字元;
R 全部取代:会一直取代游标所在的文字,直到按下 ESC 为止;

游标移动指令:
k 或向上键 向上移一个字元;
j 或向下键 向下移一个字元;
h 或向左键 向左移一个字元;
l 或向右键 向右移一个字元;
H 游标移动到萤幕顶端;
M 游标移动到萤幕正中央;
L 游标移动到萤幕最夏方;
+ 游标移动至非空白字元的下一列;
– 游标移动至非空白字元的前一列;
[Ctrl] + [b] 萤幕向『后』移动一页;
[Ctrl] + [f] 萤幕向『前』移动一页;
[Ctrl] + [u] 萤幕向『后』移动半页;
[Ctrl] + [d] 萤幕向『前』移动半页;
[n] 先按数字后再按空白键:游标向后面移动 n 个字元;
0 数字键『0』:移动到这一列的第一个字元;
$ 移动到这一行的行尾;
G 移动到最后一行;
nG 移动到第 n 行(常与 :set nu 合用);
J 将目前游标所在行与下一行连结;

搜寻指令:
/word 向游标之后寻找一个名为 『word』 的字串;
?word 向游标之前寻找一个名为 『word』 的字串;
:g/word1/s//word2/g 寻找 『word1』 这个字串,并且以 『word2』 这个字串取代之;
:n1,n2 s/word1/word2/g 将第 n1 行到 n2 行的字串 『word1』 都改成 『word2』;
:1,$ s/ls/ll/g 将所有档案内容的 『ls』 这个字串改成 『ll』 这个字串;

删除与复制:
yy 或 Y 复制游标所在行的内容;
nyy 或 nY 『n』 为数字:复制游标所在行向下 n 行之内容;
p 将 yy 复制的内容贴到游标所在行的下面;
x 删除一个字元;
nx 『n』 为数字:删除 n 个字元;
dd 删除游标所在那一行;
ndd 『n』 为数字:向下删除 n 行;
u 取消前一个动作;
[Ctrl] + [L] 清除萤幕并重绘萤幕

命令模式:
:wq 将所做修改储存后离开 vi;
:w 仅储存档案;
:w [filename] 将目前的内容储存到 『filename』 这个档案中(类似另存新档);
:r [filename] 将 『filename』 这个档案内容加到游标所在行后面;
:q 离开 vi;
:q! 强制离开 vi ;

其他指令:
:set nu 设定行号,让你可以轻易的找出错误;
:set nonu 取消设定行号;
:n1, n2 w [filename] 将 n1 到 n2 的内容存成 『filename』 这个档案;

About the author

1 comment

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

By now163

Your sidebar area is currently empty. Hurry up and add some widgets.