常用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) ...
随机推荐
- Linux虚拟主机通过FTP软件创建目录时提示550 Create Directory Operation Failed
更新时间:2017-06-07 13:26:11 分享: 问题描述 通过FTP软件连接Linux虚拟主机,在尝试创建新目录时,服务器返回错误提示:550 Create Directory Oper ...
- jquery mobile-按钮控件
jQuery Mobile 中的按钮会自动获得样式,这增强了他们在移动设备上的交互性和可用性.我们推荐您使用 data-role="button" 的 <a> 元素来创 ...
- MySql 修改外键 支持级联删除
首先必须要有外键,InnoDB甚么的都不说了,直接上修改句子. 要先删除该外键,然后添加. 具体原因貌似是因为不支持alter外键的操作. ALTER TABLE `t_terminal` DROP ...
- ceph rbd 封装api
1.安装python,uwsgi,nginx环境 pip安装省略 yumgroupinstall"Developmenttools" yuminstallzlib-develbzi ...
- Git-远程仓库的使用
Git修改远程仓库地址 1.修改命令 git remote set-url origin [url] 例如:$ git remote set-url origin gitlab@gitlab.chum ...
- mybatis配置多个数据源事务(Transaction)处理
当mybatis配置文件中只有一个数据源的时候,按照正常的事务注解形式@Transaction是没有问题的,但是当配置文件中有多个数据源的时候发现事务不起作用了,怎么解决这个问题呢?看下面的案例:
- C语言学习之选择排序
上一篇文章中讲C语言排序中的比较常见的(交换)冒泡排序,那么这篇文章也将以新手个人的经历来讲同样比较常见而实用的数组排序之选择排序. 选择排序,从字面上看是通过选择来进行排序.其实它的用法就是通过选择 ...
- word中正文分栏重新换页问题
小论文常需要正文分栏,但是标题.摘要不分栏的编排格式. 1.在摘要后面加入分隔符来将内容分为摘要和正文两个部分.选择 插入→分隔符→分节符(连续). 2.然后进行分栏.选择 格式→分栏. 3.此时如果 ...
- nodejs爬虫笔记(一)---request与cheerio等模块的应用
目标:爬取慕课网里面一个教程的视频信息,并将其存入mysql数据库.以http://www.imooc.com/learn/857为例. 一.工具 1.安装nodejs:(操作系统环境:WiN 7 6 ...
- SQL语句-INSERT语句
Insert语句 Insert语句三种写法: mysql> desc students; +-------+-------------+------+-----+---------+------ ...