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的更多相关文章

  1. Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令

    Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...

  2. 【转】Linux上vi(vim)编辑器使用教程

    Linux上vi(vim)编辑器使用教程 ------------------------------------------------------------ ikong ------------ ...

  3. Linux系统 vi/vim文本编辑器

    Linux系统 vi/vim文本编辑器 (一)Vim/Vi简介 (二)Vim/Vi工作模式 (三)Vim/Vi基本使用 (四)Vim/Vi应用技巧 (一)Vim/Vi简介 Vim/Vi是一个功能强大的 ...

  4. [Linux/Ubuntu] vi/vim 使用方法讲解(转载)

    转自:http://www.cnblogs.com/emanlee/archive/2011/11/10/2243930.html vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统 ...

  5. Linux命令vi/vim 使用方法讲解

    vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...

  6. [Linux/Ubuntu] vi/vim 使用方法讲解

    vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的 ...

  7. 新手指南:Linux上vi(vim)编辑器使用教程

    vi(vim)是上Linux非常常用的编辑器,很多Linux发行版都默认安装了vi(vim).vi(vim)命令繁多但是如果使用灵活之后将会大大提高效率.vi是“visual interface”的缩 ...

  8. Linux下Vi/Vim的使用方法

    本文介绍了vi (vim)的基本使用方法,但对于普通用户来说基本上够了!i/vim的区别简单点来说,它们都是多模式编辑器,不同的是vim 是vi的升级版本,它不仅兼容vi的所有指令,而且还有一些新的特 ...

  9. 【Linux】- vi/vim

    所有的 Unix Like 系统都会内建 vi 文书编辑器,其他的文书编辑器则不一定会存在. 但是目前我们使用比较多的是 vim 编辑器. vim 具有程序编辑的能力,可以主动的以字体颜色辨别语法的正 ...

随机推荐

  1. Notes of Daily Scrum Meeting(12.24)

    平安夜了,我们还在这里辛苦地赶代码,整个人都不好了... 今天的团队任务总结如下: 团队成员 今日团队工作 陈少杰 寻找大神帮助,调试网络连接 王迪 建立搜索的UI界面,把算法加入进去 金鑫 调试网络 ...

  2. 印象之初:BugPhobia’s Brief Introduction

    0x01 :序言 I leave uncultivated today, was precisely yestoday perishes tomorrow which the person of th ...

  3. 《Linux内核分析》第五周笔记 扒开系统调用的三层皮(下)

    扒开系统调用的三层皮(下) 一.给menuOS增加time和time-asm 通过内核调试系统调用.将上次做的实验加入到menusOS,变成menusOS里面的两个命令. 1 int Getpid(i ...

  4. Java使用HTTPClient3.0.1开发的公众平台消息模板的推送功能

    package com.company.product.manager.busniess.impl; import java.io.IOException;import java.nio.charse ...

  5. ExtJS Tab里放Grid高度自适应问题,官方Perfect方案。

    出处:http://docs.sencha.com/extjs/4.2.1/extjs-build/examples/layout-browser/layouts/combination.js // ...

  6. js堆栈

    //栈只存地址 堆存对象和地址: 浅拷贝: 深拷贝: 队列类似于过道,走廊:

  7. Oracle12c Clone PDB 的方法

    1. 创建PDB的存放路径,举例: 2. 设置 数据库创建数据文件的目录 alter system set db_Create_file_dest='C:\app\Administrator\orad ...

  8. MySQL分区和分表

    一.概念 1.为什么要分表和分区?日常开发中我们经常会遇到大表的情况,所谓的大表是指存储了百万级乃至千万级条记录的表.这样的表过于庞大,导致数据库在查询和插入的时候耗时太长,性能低下,如果涉及联合查询 ...

  9. msql 复杂练习

    https://blog.csdn.net/xiao__oaix/article/details/78122294 customer表branch 表account 表 depositor 表loan ...

  10. BatchNormalization的使用

    # import BatchNormalization from keras.layers.normalization import BatchNormalization # instantiate ...