# ------------------- VI basic -------------------------------

# file name: VI_basic
# author   :
# date     : 2014-3-25
# contact  : QQ :
#            email :
# summary  : VI editor operation for programming

# ------------------- VI basic -------------------------------

# ------ summary ---------------------------------------------
vi is an powerful file editor for programming in Linux OS.
vim       : vi improved
gvim      : GUI of vi
two mode  : editing and command mode
.vim      : highligh word file
.vimrc    : configuration file of VI

# ------ file operation -----------------------------------------

# ------ open a file -----------
vi file_name   : open a file for editing on a terminal
vim file_name  :
gvim file_name : gvim is a GUI of vi

# when open a file , vi is in insert mode by default

:i     : go to insert mode
esc   : go to command mode
:w     : write into the file (save)
:q     : quit vi
:q!    : force to quit and abort the modification
:wq    : save and quit

# ----- move cursor ------------
->/<-     : left/right/up/down
h|j|k|l   : h(left)| j(down) | k(up) l (right)
          : 3h | 4j | 5k | 6l
:w        : move forward one word eg. 3w
:b        : move backward one word eg. 4b
:$        : move to the end of a line
:^|0      : move to the beginning of a line
# ---------------------------

:gg          : go to the first line
:G           : go to the last line
:nG          : go to n line eg. 1G
:set nu      : set number line
:set nonu
CTRL + G    : display the current line and total numbers of lines
CTRL + U    : page up
CTRL + D    : page down

# ----- delete copy and paste -----

d=delete, y=copy, p=paste

:dd       : delete a line eg. 5dd
:dw       : delete a word eg. d3w
:d0       :
:d$       : delete to end of line

:yy       : copy a line et. 5yy
:yw
:y0
:y$
:Y        : copy
:5,10y    : copy 5 ~ 10 line
:,10y     : copy cursor ~ 10 line
:5,y      : copy 5 ~ cursor line

:p        : paste

:.        : repeat last operation 

:x        : delete a character eg. 3x

# ------ undo the editing  ----
:u|U      : undo
:CTRL+R   : need the modification

# ------ insert cursor -------------------
a|A       : after the cursor | end of a line
o|O       : input one new line under the current line | up the current line
:help a   : 

# ------ search  ---------------------
:/pattern : go to the pattern
          : n|N
:?pattern :
SHIFT + * : match the word marked cursor
:number_line : go to the number line

# ----- replace -----------------------
:r|R          : replace
:%s/x/y/g     : x change to y all of them
:s/x/y/g      : x change to y on the current line
:10,23s/x/y/g : 

# ----- special operation ------------------
:sp       : splite horizontally ; put some files into one terminal
CRTL + WW : change file in splite command
:ZZ|q     : quit a splite file

:set diff : compare two files
:vsp      : visual splite vertically
CRTL + WW : 

CRTL + V  : visual mode
          : d|D , y|Y, r | R 

gf        : go into file
CRTL + O  : return the original file 

# ------ other command -------------------
:.    		: repeat last operation
:J        : Merge the under line and the current line eg. 3JA
:r        : replace
:~        : change case-sensitive character 

# ----- 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. Android之MaterialDesign应用技术

    PS:纵观现在大大小小软件的界面都变的比较漂亮,还有一些系统了,比如小米的MIUI,华为的EMUI等,虽然底层都是安卓,但他们的界面多多少少都会不同,谷歌对这个UI也是非常重视的,MaterialDe ...

  2. 通过自定义的URL Scheme启动你的App

    iPhone SDK可以把你的App和一个自定义的URL Scheme绑定.该URL Scheme可用来从浏览器或别的App启动你的App. 如何响应从别的App里发给你的URL Scheme申请,由 ...

  3. [ios 开发笔记]:一句话笔记

    1.NSString转int int a=[@"123" intValue]; 同样适用于NSDictionary将NSNumber转为int   2.switch(stateme ...

  4. Java hashtable和hastmap的区别

    1. 继承和实现区别 Hashtable是基于陈旧的Dictionary类,完成了Map接口:HashMap是Java 1.2引进的Map接口的一个实现(HashMap继承于AbstractMap,A ...

  5. Java数据持久层框架 MyBatis之API学习三(XML 映射配置文件)

    对于MyBatis的学习而言,最好去MyBatis的官方文档:http://www.mybatis.org/mybatis-3/zh/index.html 对于语言的学习而言,马上上手去编程,多多练习 ...

  6. (2-1)SpringCloue-Eureka实现高可用注册中心

    高可用注册中心 在微服务架构这样的分布式环境中,我们需要充分考虑发生故障的情况,所以在生产环境中必须对各个组件进行高可用部署.在eureka-server中的application.yml中我们还记得 ...

  7. java1.8--1.8入门介绍

    在我之前的工作中,一直使用的是java6.所以即使现在java已经到了1.8,对于1.7增加的新特性我也基本没使用的.在整理一系列1.8的新特性的过程中,我也会添加上1.7增加的特性. 下面的整理可能 ...

  8. jdk源码->集合->LinkedList

    类的属性 public class LinkedList<E> extends AbstractSequentialList<E> implements List<E&g ...

  9. z-index在IE中的坑

    在CSS2.1规范中,每个盒模型的位置是三维的,分别是平面画布上的x轴,y轴以及表示层叠的z轴.对于每个html元素,都可以通过设置z-index属性来设置该元素在视觉渲染模型中的层叠顺序. z-in ...

  10. IO (四)

    1 深度遍历文件夹 示例: package java20; import java.io.File; import java.io.FilenameFilter; import java.text.S ...