Linux command ------ vi / vim
EDIT mode to GENERAL mode: press ESC
General mode: operate file
:q! :force to close the file but not save(file has been modified)
:wq! :force to save and close the file
:q : close the file but not save(file hasn't been modified)
:wq : save and close the file
:w:save file
General mode to edit mode
i :insert a charactor before cursor, and enter EDIT mode
a : insert a charactor after cursor, and enter EDIT mode
o : insert a new line backward, and enter EDIT mode
General mode: move cursor
) :cursor move to the end of line
( :cursor move to the beginning of line
G : cursor move to the last line of the file
gg : cursor move to the first line of the file
General mode: delete
dd :delete(cut) the line where cursor is
D : delete the charactors in the back of cursor in a line, include the character of cursor
x,X:in the character of a line, x means "delete the character of cursor", X means "delete the character before cursor
General mode: OTHERS
u :cancel the last operation
:/linux : search linux, then tap 'n' to search the next one
:?linux: search linux, then tap 'n' to search the next one
p : paste the stuff after the line of cursor
P : paste the stuff before the line of cursor
set nu:show row number
General mode: execute cmd without exit vi/vim
:!cmd
不退出vim 执行命令 cmd
:r !cmd
不退出vim执行命令cmd,并将cmd的输出内容插入当前文本中。
:shell
切换到shell里(此时并没有退出vim,可以理解成vim转入后台),你可以在shell中做任何操作,退出shell(比如用exit)后,会切换回原来的vim中
vim 的一些设置
linux环境下vim的初始化配置文件为.vimrc, 通常有两个,分别是系统版本和用户版本,前者不同发行版linux会有不同,一般位于/etc/vimrc,是整个系统vim的默认配置;后者位于~/.vimrc,是当前用户的vim配置,会覆盖系统配置。
vim ~/.vimrc
set tabstop= " 设置当前用户 vim 使用中 tab 是四个空格" set fencs=utf-,GB18030,ucs-bom,default,latin1 " 显示中文字符" set nocompatible "关闭vi兼容模式,可以启用方向键和Backspace" syntax on "自动语法高亮(对于编程语言中的关键字高亮需要下载相应的编程语言对应的"配色方案.vim文件"" colorscheme industry "选择industry.vim配色方案,文件在/usr/share/vim/vimxx/colors,推荐 industry、slate、murphy"
不需要执行 source ~/.vimrc 即可生效(执行了反而提示某些指令找不到,比如 syntax)
Linux command ------ vi / vim的更多相关文章
- Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令
Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...
- 【转】Linux上vi(vim)编辑器使用教程
Linux上vi(vim)编辑器使用教程 ------------------------------------------------------------ ikong ------------ ...
- Linux系统 vi/vim文本编辑器
Linux系统 vi/vim文本编辑器 (一)Vim/Vi简介 (二)Vim/Vi工作模式 (三)Vim/Vi基本使用 (四)Vim/Vi应用技巧 (一)Vim/Vi简介 Vim/Vi是一个功能强大的 ...
- [Linux/Ubuntu] vi/vim 使用方法讲解(转载)
转自:http://www.cnblogs.com/emanlee/archive/2011/11/10/2243930.html vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统 ...
- Linux命令vi/vim 使用方法讲解
vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...
- [Linux/Ubuntu] vi/vim 使用方法讲解
vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...
- 新手指南:Linux上vi(vim)编辑器使用教程
vi(vim)是上Linux非常常用的编辑器,很多Linux发行版都默认安装了vi(vim).vi(vim)命令繁多但是如果使用灵活之后将会大大提高效率.vi是“visual interface”的缩 ...
- Linux下Vi/Vim的使用方法
本文介绍了vi (vim)的基本使用方法,但对于普通用户来说基本上够了!i/vim的区别简单点来说,它们都是多模式编辑器,不同的是vim 是vi的升级版本,它不仅兼容vi的所有指令,而且还有一些新的特 ...
- 【Linux】- vi/vim
所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一定会存在. 但是目前我们使用比较多的是 vim 编辑器. vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正 ...
随机推荐
- linux内核分析第八次实验
20135118 罗鹏越 本周学习的是linux内核中的进程调度,之前我们在操作系统中有讲解进程调度的分类,以及一些调度算法.而linux中的进程调度有所不同,首先老师讲解了进程调度和进程调度的时机, ...
- 转发:C#操作SQL Server数据库
转发自:http://www.cnblogs.com/rainman/archive/2012/03/13/2393975.html 1.概述 2.连接字符串的写法 3.SqlConnection对象 ...
- Eclipse 项目有红感叹号
问题原因]:工程中classpath中指向的包路径错误 [解决办法]:右键项目名称 BuildPath ---> Configure Build Paht...中,然后上面有几个选项卡找到 Li ...
- HDOJ2007_平方和与立方和
应该注意到一个细节是题目中没有说明输入的两个数据一定是先小后大的关系,所以需要做一次判断.其他的比较简单. HDOJ2007_平方和与立方和 #include<iostream> #inc ...
- JEECG--去掉(增加)登陆页面验证码功能 - CSDN博客
JEECG--去掉(增加)登陆页面验证码功能 - CSDN博客https://blog.csdn.net/KooKing_L/article/details/79711379
- Hadoop技术里面有BSP模型、MPI模型
MPI模型,各种编程语言的库挺多. BSP模型,刚才知道.
- 同步或者重构Activiti Identify用户数据的多种方案比较
http://www.kafeitu.me/activiti/2012/04/23/synchronize-or-redesign-user-and-role-for-activiti.html 如何 ...
- Maven2查看源码
- python decimal.quantize()参数rounding的各参数解释与行为
我最开始其实是由于疑惑ROUND_FLOOR和 ROUND_DOWN的表现区别才看了一波文档,但是感觉拉出一票以前没有留意过的东西. 贴一个decimal文档里面的解释: ROUND_CEILING ...
- 多条件查询 仿淘宝URL传参方式
---恢复内容开始--- 最近项目在做一个电商网站,网站涉及到前后台交互的多条件查询,类似于淘宝的多条件查询,图片如下 此类查询主要涉及到的问题有: 1.如何记忆查询参数 2.如何前后台传值 3.中文 ...