1. # ------------------- VI basic -------------------------------
  2.  
  3. # file name: VI_basic
  4. # author :
  5. # date : 2014-3-25
  6. # contact : QQ :
  7. # email :
  8. # summary : VI editor operation for programming
  9.  
  10. # ------------------- VI basic -------------------------------
  11.  
  12. # ------ summary ---------------------------------------------
  13. vi is an powerful file editor for programming in Linux OS.
  14. vim : vi improved
  15. gvim : GUI of vi
  16. two mode : editing and command mode
  17. .vim : highligh word file
  18. .vimrc : configuration file of VI
  19.  
  20. # ------ file operation -----------------------------------------
  21.  
  22. # ------ open a file -----------
  23. vi file_name : open a file for editing on a terminal
  24. vim file_name :
  25. gvim file_name : gvim is a GUI of vi
  26.  
  27. # when open a file , vi is in insert mode by default
  28.  
  29. :i : go to insert mode
  30. esc : go to command mode
  31. :w : write into the file (save)
  32. :q : quit vi
  33. :q! : force to quit and abort the modification
  34. :wq : save and quit
  35.  
  36. # ----- move cursor ------------
  37. ->/<- : left/right/up/down
  38. h|j|k|l : h(left)| j(down) | k(up) l (right)
  39. : 3h | 4j | 5k | 6l
  40. :w : move forward one word eg. 3w
  41. :b : move backward one word eg. 4b
  42. :$ : move to the end of a line
  43. :^|0 : move to the beginning of a line
  44. # ---------------------------
  45.  
  46. :gg : go to the first line
  47. :G : go to the last line
  48. :nG : go to n line eg. 1G
  49. :set nu : set number line
  50. :set nonu
  51. CTRL + G : display the current line and total numbers of lines
  52. CTRL + U : page up
  53. CTRL + D : page down
  54.  
  55. # ----- delete copy and paste -----
  56.  
  57. d=delete, y=copy, p=paste
  58.  
  59. :dd : delete a line eg. 5dd
  60. :dw : delete a word eg. d3w
  61. :d0 :
  62. :d$ : delete to end of line
  63.  
  64. :yy : copy a line et. 5yy
  65. :yw
  66. :y0
  67. :y$
  68. :Y : copy
  69. :5,10y : copy 5 ~ 10 line
  70. :,10y : copy cursor ~ 10 line
  71. :5,y : copy 5 ~ cursor line
  72.  
  73. :p : paste
  74.  
  75. :. : repeat last operation
  76.  
  77. :x : delete a character eg. 3x
  78.  
  79. # ------ undo the editing ----
  80. :u|U : undo
  81. :CTRL+R : need the modification
  82.  
  83. # ------ insert cursor -------------------
  84. a|A : after the cursor | end of a line
  85. o|O : input one new line under the current line | up the current line
  86. :help a :
  87.  
  88. # ------ search ---------------------
  89. :/pattern : go to the pattern
  90. : n|N
  91. :?pattern :
  92. SHIFT + * : match the word marked cursor
  93. :number_line : go to the number line
  94.  
  95. # ----- replace -----------------------
  96. :r|R : replace
  97. :%s/x/y/g : x change to y all of them
  98. :s/x/y/g : x change to y on the current line
  99. :10,23s/x/y/g :
  100.  
  101. # ----- special operation ------------------
  102. :sp : splite horizontally ; put some files into one terminal
  103. CRTL + WW : change file in splite command
  104. :ZZ|q : quit a splite file
  105.  
  106. :set diff : compare two files
  107. :vsp : visual splite vertically
  108. CRTL + WW :
  109.  
  110. CRTL + V : visual mode
  111. : d|D , y|Y, r | R
  112.  
  113. gf : go into file
  114. CRTL + O : return the original file
  115.  
  116. # ------ other command -------------------
  117. :. : repeat last operation
  118. :J : Merge the under line and the current line eg. 3JA
  119. :r : replace
  120. :~ : change case-sensitive character
  121.  
  122. # ----- auto complenment ----------------

  

常用VI操作命令的更多相关文章

  1. 【Linux学习】Vi 操作命令集合

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

  2. CentOS运维常用管理操作命令

    自己整理的整理Linux常用运维和linux常用管理操作命令,当然不是非常详细和丰富,但是也基本上够用了吧.欢迎留言补充更多的Linux常用运维和linux常用管理操作命令.不断完善中.... 备份m ...

  3. git中常用的操作命令有哪些?常用操作命令归纳

    git中常用的操作命令有哪些?本篇文章就给到大家归纳了一些git中常用操作命令.有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. git开始 全局配置:配置用户名和e-mail地址 1 ...

  4. 记录 git 常用的操作命令总结

    记录 git 常用的操作命令总结 2016-12-15 16:44:04 作为一名开发者,熟悉使用 git 代码管理工具是一项必备的基本技能.git 相较 SVN 而言,其优点不言而喻.git 的功能 ...

  5. dos常用文件操作命令

    1.DIR 含义: 显示指定目录下的文件和子目录列表 类型: 内部命令 格式: DIR[drive:][path][filename][/p][/w][/A[[:]attributes]][/O[[: ...

  6. centos文件/文件夹操作-检查磁盘、内存、cpu使用情况-vi操作命令

    Part1:CentOS文件/文件夹操作 1.新建文件夹 即创建目录 mkdir 文件名 新建一个名为test的文件夹在home下 vi source1 mkdir /home/test 注意:当创建 ...

  7. GlusterFS常用维护操作命令

    GlusterFS常用维护操作命令 1.启动/关闭/查看glusterd服务 # /etc/init.d/glusterd start # /etc/init.d/glusterd stop # /e ...

  8. [Linux] Linux常用文本操作命令整理

    简单的总结一下常用的一些实用的Linux文本操作命令,包括wc(统计).cut(切分).sort(排序).uniq(去重).grep(查找).sed(替换.插入.删除).awk(文本分析). 1.统计 ...

  9. Linux vi 操作命令整理

    转自:http://www.lupaworld.com/?uid-296380-action-viewspace-itemid-118973   vi/vim 基本使用方法 本文介绍了vi (vim) ...

随机推荐

  1. Anaconda更新和第三方包更新

    更新Anaconda和它所包含的包 1.打开cmd,切换到Anaconda的Scripts目录下:./Anaconda3/Scripts 2.更新Anaconda conda update conda ...

  2. win7系统如何在防火墙里开放端口

    用到的端口需要在防火墙里开放,win7的比XP的要复杂一些,此方法同样适用于server2008系统 方法/步骤 1 依次点击"开始"-"控制面板"-" ...

  3. ADO.NET复习总结(6)-断开式数据操作

    一.基础知识 主要类及成员(和数据库无关的)(1)类DataSet:数据集,对应着库,属性Tables表示所有的表(2)类DataTable:数据表,对应着表,属性Rows表示所有的行(3)类Data ...

  4. 为什么alertView弹出后button会消失的问题

    按option后会有提示:Do not use the label object to set the text color or the shadow color. Instead, use the ...

  5. 用Java 实现一个表中的数据复制到另一个表中

    string sql = "insert into tbl1(s1,s2,s3) select t.t1,t.t2,t.t3 from tab2 t";再用jdbc或者hibern ...

  6. CentOS 7安装Oracle 11gR2以及设置自启动

    一.环境准备 1.正确无误的CentOS 7系统环境 CentOS 7安装:http://www.cnblogs.com/VoiceOfDreams/p/8043958.html 2.正确的JDK环境 ...

  7. Linux Server release 7.3 更换阿里网络yum源

    查看当前系统下的yum源 [root@localhost ~]# rpm -qa |grep yum yum-3.4.3-150.el7.noarch yum-utils-1.1.31-40.el7. ...

  8. mysql explain用法和结果的含义

    转自:http://blog.chinaunix.net/uid-540802-id-3419311.html explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择 ...

  9. intellij springmvc的配置文件报错

    报错: Checks references injected by IntelliLang plugin. Cannot resolve bean  解决: File--Settings[或直接CTR ...

  10. Express使用进阶:cookie-parser中间件实现深入剖析

    文章导读 cookie-parser是Express的中间件,用来实现cookie的解析,是官方脚手架内置的中间件之一. 它的使用非常简单,但在使用过程中偶尔也会遇到问题.一般都是因为对Express ...