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 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正 ...
随机推荐
- C. Make It Equal
链接 [http://codeforces.com/contest/1065/problem/C] 题意 给你n个高度hi的塔,让你把高的部分切掉,使得最后所有塔一样高,而且每次切的高度之和不大于k ...
- B. Heaters Div3
链接 [http://codeforces.com/contest/1066/problem/B] 分析 具体看代码,贪就完事了 代码 #include<bits/stdc++.h> us ...
- 对TCP重传的进一步认识
http://blog.sina.com.cn/s/blog_4d276ac901011ee7.html ——TCM项目所得 一.看图说话 1.基于套接字的TCP服务器/客户端程序流程 2.TCP三次 ...
- Appium学习笔记4_元素定位方法
Appium之元素定位,如果对Android上如何使用工具获取页面元素有问题的,请转战到这:http://www.cnblogs.com/taoSir/p/4816382.html. 下面主要是针对自 ...
- 用IntelliJ IDEA编译,编译之后提示 无效的标记: -release
软件版本:ideaIU-2016.3.2 JDK:jdk-9.0.4_windows-x64_bin 开始的时候建立一个maven项目,发现编译的时候提示[无效的标记: -release],以为是项目 ...
- ecshop验证码图片无法显示终极解决办法
ecshop验证码图片无法显示终极解决办法 ECSHOP教程/ ecshop教程网(www.ecshop119.com) 2014-06-06 客户在安装好ecshop之后所有前台的证码不显示,后 ...
- Oracle10.2.0.1以及其他版本升级Oracle10.2.0.5的简单步骤
Oracle没有发布 完整版的 Oracle 10.2.0.5 的安装包,只能是通过安装完10.2.0.4 之后再升级10.2.0.5 这一点挺坑的. 建安记录一下步骤. 1. 挂载Oracle10. ...
- MongoDB导入导出以及数据库备份以及.dat数据
1.导出工具:mongoexport 1.概念: mongoDB中的mongoexport工具可以把一个collection导出成JSON格式或CSV格式的文件.可以通过参数指 ...
- centos目录
cd /opt cd /home/lujie cd /etc cd /usr cd /dev cd /bin cd /mnt cd /media cd /tmp
- PostgreSQL、SQL Server数据库中的数据类型的映射关系
PostgreSQL 8.1 轰动发布,我也打算将原来使用 SQL Server 的一些应用迁移到 PostgreSQL 上,首先需要迁移的是表,那么这就必须要先搞清楚这两个数据库中的数据类型的映射关 ...