当前位置:网站首页>vim编辑器知识总结
vim编辑器知识总结
2022-07-04 22:30:00 【宋小羽】

1. 三种模式
输入vi/vim <filename>即可进入一个文件(不论这个文件是否存在)的命令模式,输入wq等底线命令可退出文件命令模式。
工作模式示意图

命令模式
输入
i o a等可进到输入模式;输入
:即可进入底线命令模式输入模式
除
Esc键外,其他按键均为输入;按
Esc键即可退出输入模式,进入到命令模式。底线命令模式
操作命令以
回车结束底线命令模式;按
Esc键即可退出输入模式,进入到命令模式。
2. 不同模式下的命令介绍
2.1 命令模式
移动光标
0数字0,移动到这一行的最前面字符处$移动到这一行的最后面字符处G移动到这个文件的最后一行nGn为整数,移动到这个文件的n行gg移动到这个文件的第一行,相当于1Gn<Enter>n为整数,以当前行为准,向下移动n行搜索替换 *
/word光标之下搜索一个名称为word的字符串n向下继续寻找上一步的搜索字符串内容N向上继续寻找上一步的搜索字符串内容复制、粘贴和删除 **
x,Xx表示删除光标所在的后一个字符;X表示删除光标所在的前一个字符dd删除光标所在的当前行nddn为整数,删除光标所在的向下n行(从光标所在行开始)yy复制光标所在的当前行nyyn为整数,复制光标所在的向下n行(从光标所在行开始)p,Pp为将已复制的数据粘贴到光标下一行, P则是粘贴到光标的上一行u复原前一个动作Ctrl+r重做上一个动作.小数点,重复上一个动作
2.2 命令模式切换到输入模式的相关按钮
进入输入模式
i从目前光标所在处输入I当前所在行的第一个非空字符处输入a从目前光标所在的下一个字符处开始输入A当前所在行的最后一个字符处输入o小写字母o,在目前光标所在的下一行处输入新的一行O大写字母o,在目前光标所在的上一行处输入新的一行进入取代模式
r取代光标所在的一个字符R一直取代光标所在的文字,直到按下 ESC 为止退出输入模式
Esc退出输入模式,回到命令模式
2.3 命令模式切换到底线命令模式
储存和退出文件等命令
:w保存修改:q退出vi编辑模式:wq保存修改并退出vi编辑模式ZZ大写的字母z,等同于:wq,保存修改并退出vi编辑模式:<>!命令后加!号,表示强制的操作行号显示操作
:set nu显示行号:set nonu取消显示行号
参考文档
边栏推荐
- Redis入门完整教程:客户端通信协议
- Talk about Middleware
- Practice and principle of PostgreSQL join
- md5工具类
- Locust performance test - environment construction and use
- La prospérité est épuisée, les choses sont bonnes et mauvaises: Où puis - je aller pour un chef de station personnel?
- Shell script implements application service log warehousing MySQL
- Logo special training camp section 1 Identification logo and logo design ideas
- 攻防世界 MISC 进阶区 hit-the-core
- About stack area, heap area, global area, text constant area and program code area
猜你喜欢

2022-07-04: what is the output of the following go language code? A:true; B:false; C: Compilation error. package main import “fmt“ func main() { fmt.Pri

Breakpoint debugging under vs2019 c release

攻防世界 MISC 进阶区 3-11

【OpenGL】笔记二十九、抗锯齿(MSAA)
[the 2023 autumn recruitment of MIHA tour] open [the only exclusive internal push code of school recruitment eytuc]

Advanced area of attack and defense world misc 3-11

Persistence mechanism of redis
![[roommate learned to use Bi report data processing in the time of King glory in one game]](/img/06/22dde3fcc0456bd230e1d0cde339ec.png)
[roommate learned to use Bi report data processing in the time of King glory in one game]

Attack and defense world misc advanced area ditf

Google Earth Engine(GEE)——基于 MCD64A1 的 GlobFire 日常火灾数据集
随机推荐
Install the gold warehouse database of NPC
Detailed explanation of flask context
记录:关于Win10系统中Microsoft Edge上的网页如何滚动截屏?
剑指Offer 68 - II. 二叉树的最近公共祖先
攻防世界 MISC 进阶区 3-11
The new version judges the code of PC and mobile terminal, the mobile terminal jumps to the mobile terminal, and the PC jumps to the latest valid code of PC terminal
堆排序代码详解
特征缩放 标准化 归一化
共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf
Duplicate ADMAS part name
攻防世界 misc 进阶区 2017_Dating_in_Singapore
剑指 Offer 65. 不用加减乘除做加法
PMO: compare the sample efficiency of 25 molecular optimization methods
Advanced area of attack and defense world misc 3-11
攻防世界 MISC 进阶区 Erik-Baleog-and-Olaf
关于栈区、堆区、全局区、文字常量区、程序代码区
攻防世界 misc 高手进阶区 a_good_idea
Analysis of the self increasing and self decreasing of C language function parameters
华泰证券是国家认可的券商吗?开户安不安全?
Naacl-22 | introduce the setting of migration learning on the prompt based text generation task