vim的模式

vim有无数种模式,mode,而且还在随时更新中,真是无法一一列举,可通过指令查看:

:help vim-modes

但我们经常使用的往往只有四种:

  • normal mode
  • insert mode
  • command mode
  • visual mode

Normal mode

这个就是打开vim的默认模式,这个模式的关键字,就是navigation。最常见的操作,就是u,i,j,k各种光标的移动了。

从normal mode可以进入各种其他mode,方式不一,要查看文档。从其他mode回到normal mode的方法,一般就是按ESC键

insert mode

这个模式的关键字,就是edit。基本上各种编辑,都在insert mode下执行,

几种常见的由normal mode进入insert mode方法:

  • i – insert text before cursor
  • I – insert text before first non-blank character in same line
  • a – insert text after cursor
  • A – insert text at the end of line
  • o – Start a new line below cursor, insert text
  • O – start new line above cursor, insert

command mode

这个模式的关键字,就是command。各种指令,都可以在command模式下执行,比如替换,比如buffer操作 ,register指令等等

在normal mode输入冒号后,就进入command mode。

visual mode

这个模式一般是辅助其他模式使用,这个模式的关键字,就是select,用可视化的方式选择各种内容,然后再进行copy, delete或者replace等操作。

由normal mode进入visual mode的方法:

  • v – individual Visual mode
  • C-v – blockwise Visual mode
  • V – linewise Visual mode


发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

About Me

一位程序员,会弹吉他,喜欢读诗。
有一颗感恩的心,一位美丽的妻子,两个可爱的女儿
mail: geraldlee0825@gmail.com
github: https://github.com/lisuxiaoqi
medium: https://medium.com/@geraldlee0825