常用VI操作命令
# ------------------- 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操作命令的更多相关文章
- 【Linux学习】Vi 操作命令集合
Vi 操作命令集合 进入vi的命令 vi filename :打开或新建文件,并将光标置于第一行首 vi +n filename :打开文件,并将光标置于第n行首 vi + filename :打开文 ...
- CentOS运维常用管理操作命令
自己整理的整理Linux常用运维和linux常用管理操作命令,当然不是非常详细和丰富,但是也基本上够用了吧.欢迎留言补充更多的Linux常用运维和linux常用管理操作命令.不断完善中.... 备份m ...
- git中常用的操作命令有哪些?常用操作命令归纳
git中常用的操作命令有哪些?本篇文章就给到大家归纳了一些git中常用操作命令.有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助. git开始 全局配置:配置用户名和e-mail地址 1 ...
- 记录 git 常用的操作命令总结
记录 git 常用的操作命令总结 2016-12-15 16:44:04 作为一名开发者,熟悉使用 git 代码管理工具是一项必备的基本技能.git 相较 SVN 而言,其优点不言而喻.git 的功能 ...
- dos常用文件操作命令
1.DIR 含义: 显示指定目录下的文件和子目录列表 类型: 内部命令 格式: DIR[drive:][path][filename][/p][/w][/A[[:]attributes]][/O[[: ...
- centos文件/文件夹操作-检查磁盘、内存、cpu使用情况-vi操作命令
Part1:CentOS文件/文件夹操作 1.新建文件夹 即创建目录 mkdir 文件名 新建一个名为test的文件夹在home下 vi source1 mkdir /home/test 注意:当创建 ...
- GlusterFS常用维护操作命令
GlusterFS常用维护操作命令 1.启动/关闭/查看glusterd服务 # /etc/init.d/glusterd start # /etc/init.d/glusterd stop # /e ...
- [Linux] Linux常用文本操作命令整理
简单的总结一下常用的一些实用的Linux文本操作命令,包括wc(统计).cut(切分).sort(排序).uniq(去重).grep(查找).sed(替换.插入.删除).awk(文本分析). 1.统计 ...
- Linux vi 操作命令整理
转自:http://www.lupaworld.com/?uid-296380-action-viewspace-itemid-118973 vi/vim 基本使用方法 本文介绍了vi (vim) ...
随机推荐
- 什么是MVC ?
记得第一次面试phper(php是对我来说可以快速上手的另一web开发语言),人家问我MVC,我只知道m就是model,v就是view,c就是Controller,具体把其它的认识我是一无所知,结果我 ...
- PHP中file_exists()函数不能检测包含中文的文件名的解决办法
版权声明:本文为博主原创文章,未经博主允许不得转载. PHP中一般使用file_exists()判断某个文件或者文件夹是否存在,如果文件或文件夹存在则返回true,不存在则返回fal ...
- 把要写的内容做个list,半年过去了
先说点题外话,来国家气象局的第三周,今天出去和丁书记吃了个饭,基本在聊大学时候的人和事,好像都没怎么变,只是不联系的人愈发不会再联系. 抛开学校的课程不谈,半年做了三件事:CUMT校园导航 / Ope ...
- get最简单直接粗爆git与github教程
Git是分布式版本控制系统(可以理解为文件管理拓展工具) github一个在线文件托管系统(可以理解为一个在线云盘) 准备工作,在git官网下载git软件件,安装git软件,以windows.为例,下 ...
- HTTP常用方法
GET : 获取资源 get方法用来请求访问已被URI识别的资源. 请求 GET /index.html HTTP/1.1 HOST:www.baidu.com 响应 返回index.html的页面资 ...
- Java基础——反射 reflect
什么是反射 (1)Java反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法:对于任意一个对象,都能够调用它的任意一个方法和属性:这种动态获取的信息以及动态调用对象的方法的功能称 ...
- AI_神经网络监督学习
神经网络的神奇之处在哪? 所有神经网络创造出来的价值,都是由一种机器学习,称之为监督学习, 下面这些例子神经网络效果拔群,通过深度学习获利最多的是在线广告 技术的进步来源于计算机视觉和深度学习 例如: ...
- 基于百度地图SDK和Elasticsearch GEO查询的地理围栏分析系统(2)-查询实现
在上一篇博客中,我们准备好了数据.现在数据已经以我们需要的格式,存放在Elasticsearch中了. 本文讲述如何在Elasticsearch中进行空间GEO查询和聚合查询,以及如何准备ajax接口 ...
- ajax请求返回乱码
1,web.xml中有如下配置: <!-- 编码过滤器 --> <filter> <filter-name>encodingFilter</filter-na ...
- ActiveMQ入门练习
ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provider实现,尽管JMS规范出台已经是很久 ...