The following tables contain all the basic vi commands. 

 *Starting vi*

 Command                       Description
vi file start at line 1 of file
vi +n file start at line n of file
vi + file start at last line of file
vi +/pattern file start at pattern in file
vi -r file recover file after a system crash *Saving files and quitting vi* Command Description
:e file edit file (save current file with *:w* first)
:w save (write out) the file being edited
:w file save as file
:w! fil e save as an existing file
:q quit *vi*
:wq save the file and quit *vi*
:x save the file if it has changed and quit *vi*
:q! quit *vi* without saving changes *Moving the cursor* Keys pressed Effect
h left one character
l or <Space> right one character
k up one line
j or <Enter> down one line
b left one word
w right one word
( start of sentence
) end of sentence
{ start of paragraph
} end of paragraph
1G top of file
nG line n
G end of file
<Ctrl>W first character of insertion
<Ctrl>U up ½ screen
<Ctrl>D down ½ screen
<Ctrl>B up one screen
<Ctrl>F down one screen *Inserting text* Keys pressed Text inserted
a after the cursor
A after last character on the line
i before the cursor
I before first character on the line
o open line below current line
O open line above current line *Changing and replacing text* Keys pressed Text changed or replaced
cw word
3cw three words
cc current line
5cc five lines
r current character only
R current character and those to its right
s current character
S current line
~ switch between lowercase and uppercase *Deleting text* Keys pressed Text deleted
x character under cursor
12x 12 characters
X character to left of cursor
dw word
3dw three words
d0 to beginning of line
d$ to end of line
dd current line
5dd five lines
d{ to beginning of paragraph
d} to end of paragraph
:1,. d to beginning of file
:.,$ d to end of file
:1,$ d whole file *Using markers and buffers* Command Description
mf set marker named ``f''
`f go to marker ``f''
´f go to start of line containing marker ``f''
"s12yy copy 12 lines into buffer ``s''
"ty} copy text from cursor to end of paragraph into buffer ``t''
"ly1G copy text from cursor to top of file into buffer ``l''
"kd`f cut text from cursor up to marker ``f'' into buffer ``k''
"kp paste buffer ``k'' into text *Searching for text* Search Finds
/and next occurrence of ``and'', for example, ``and'', ``stand'',``grand''
?and previous occurrence of ``and''
/^The next line that starts with ``The'', for example, ``The'',``Then'', ``There''
/^The\> next line that starts with the word ``The''
/end$ next line that ends with ``end''
/[bB]ox next occurrence of ``box'' or ``Box''
n repeat the most recent search, in the same direction
N repeat the most recent search, in the opposite direction *Searching for and replacing text* Command Description
:s/pear/peach/g replace all occurrences of ``pear'' with ``peach'' on current line
:/orange/s//lemon/g change all occurrences of ``orange'' into ``lemon'' on next line containing ``orange''
:.,$/\<file/directory/g replace all words starting with ``file'' by ``directory'' on every line from current line onward, for example,``filename'' becomes ``directoryname''
:g/one/s//1/g replace every occurrence of ``one'' with 1, for example,``oneself'' becomes ``1self'', ``someone'' becomes ``some1'' *Matching patterns of text* Expression Matches
. any single character
* zero or more of the previous expression
.* zero or more arbitrary characters
\< beginning of a word
\> end of a word
\ quote a special character
\* the character ``*''
^ beginning of a line
$ end of a line
[set] one character from a set of characters
[XYZ] one of the characters ``X'', ``Y'', or ``Z''
[[:upper:]][[:lower:]]* one uppercase character followed by any number of lowercase characters
[^set] one character not from a set of characters
[^XYZ[:digit:]] any character except ``X'', ``Y'', ``Z'', or a numeric digit *Options to the :set command* Option Effect
all list settings of all options
ignorecase ignore case in searches
list display <Tab> and end-of-line characters
mesg display messages sent to your terminal
nowrapscan prevent searches from wrapping round the end or beginning ofa file
number display line numbers
report=5 warn if five or more lines are changed by command
term=ansi set terminal type to ``ansi''
terse shorten error messages
warn display ``[No write since last change]'' on shell escape if filehas not been saved

[转]vi command summary的更多相关文章

  1. keil l251 command summary --Lib

    keil l251 command summaryLIB251 LIST MYLIB.LIB TO MYLIB.LST PUBLICS LIB251 EXTRACT MYLIB.LIB (GOODCO ...

  2. Centos7修改profile文件后导致vi command not find

    Centos7修改profile文件后导致vi command not find,原因是profile文件没有配置正确,系统就无法找到精确命令了.解决方法: 1.在命令行中输入:export PATH ...

  3. Mac 终端命令行报错 -bash: vi: command not found

    我遇到的问题与这个类似,但是我的问题也是用该博文作者方法进行中断才解决的,在此表示感谢. 前段时间在 Mac 下使用终端遇到了这个问题: appledeMacBook-Air:~ air$ vi .b ...

  4. Docker---(6)问题:bash: vi: command not found

    原文:Docker---(6)问题:bash: vi: command not found 版权声明:欢迎转载,请标明出处,如有问题,欢迎指正!谢谢!微信:w1186355422 https://bl ...

  5. -bash:vi:command not find 问题解决

    Linux命令行输入命令执行后报“bash:vi:command not found”. 这是由于系统PATH设置问题,PATH没有设置对,系统就无法找到精确命令了. 1.在命令行中输入:export ...

  6. vi command

    进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文件,并将光标置于最后 ...

  7. Vi Command 【转载】

    原文: http://www.cnblogs.com/Jesenwuzj/archive/2010/03/18/1688776.html Vi中文手册 1.vi的基本概念 基本上vi可以分为三种状态, ...

  8. [Linux-vi] The simple set of vi command

    Source : https://www.cs.colostate.edu/helpdocs/vi.html What is vi? The default editor that comes wit ...

  9. Docker:bash: vi: command not found

    在使用docker容器时,有时候里边没有安装vim,敲vim命令时提示说:vim: command not found,这个时候就需要安装vim 操作步鄹: 1.apt-get update 2.ap ...

随机推荐

  1. usb驱动开发14之设备生命线

    直接看代码吧. /*-------------------------------------------------------------------*/ /** * usb_submit_urb ...

  2. 网络/运维工程师visio2013模具图标 绘制漂亮的网络拓扑图 狮子XL工程师美学思想

    visio2013狮子XL自定义运维模具下载: 链接:http://pan.baidu.com/s/1bo779Kz 密码:xh3s 狮子XL 的美学思想: 1,一次痛苦,一生幸福. 之前,在绘制网络 ...

  3. Putty颜色设置

    默认的Putty颜色和字体太不好看了,得自己设置: 字体:毫无疑问Consolas, 10-point:看起来非常清新自然 颜色: * Default Foreground: 255/255/255  ...

  4. SM2国密证书合法性验证

    通常我们遇到过的X509证书都是基于RSA-SHA1算法的,目前国家在大力推行国密算法,未来银行发行的IC卡也都是基于PBOC3.0支持国密算法的,因此我们来学习一下如何验证SM2国密证书的合法性.至 ...

  5. opencv6.5-imgproc图像处理模块之轮廓

    接opencv6.4-imgproc图像处理模块之直方图与模板 这部分的<opencv_tutorial>上都是直接上代码,没有原理部分的解释的. 十一.轮廓 1.图像中找轮廓 /// 转 ...

  6. 读懂IL代码就这么简单(二)

    一 前言 IL系列 第一篇写完后 得到高人指点,及时更正了文章中的错误,也使得我写这篇文章时更加谨慎,自己在了解相关知识点时,也更为细致.个人觉得既然做为文章写出来,就一定要保证比较高的质量,和正确率 ...

  7. 理解AngularJS生命周期:利用ng-repeat动态解析自定义directive

    ng-repeat是AngularJS中一个非常重要和有意思的directive,常见的用法之一是将某种自定义directive和ng-repeat一起使用,循环地来渲染开发者所需要的组件.比如现在有 ...

  8. AVL树插入操作实现

    为了提高二插排序树的性能,规定树中的每个节点的左子树和右子树高度差的绝对值不能大于1.为了满足上面的要求需要在插入完成后对树进行调整.下面介绍各个调整方式. 右单旋转 如下图所示,节点A的平衡因子(左 ...

  9. Php 安装 curl

    一.用好tab键.输入一部分,就按两次tab键,看看到底应该安什么

  10. 为什么要加入<!doctype html>这个文档声明——IE怪异模式

    调试了很久,发现了一个非常细微但又十分重要的问题,又一次我在对于文档声明类型的时候,声明了如下类型 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1 ...