当前位置:网站首页>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的持久化机制
- 模拟摇杆控制舵机
- Advanced area a of attack and defense world misc Masters_ good_ idea
- 剑指 Offer 68 - I. 二叉搜索树的最近公共祖先
- Now MySQL cdc2.1 is parsing the datetime class with a value of 0000-00-00 00:00:00
- MySQL Architecture - user rights and management
- [try to hack] wide byte injection
- 通过Go语言创建CA与签发证书
- 攻防世界 misc 高手进阶区 a_good_idea
- Gnawing down the big bone - sorting (II)
猜你喜欢

The overview and definition of clusters can be seen at a glance

【室友用一局王者荣耀的时间学会了用BI报表数据处理】

LOGO special training camp section I identification logo and Logo Design Ideas

Logo special training camp Section V font structure and common design techniques

Business is too busy. Is there really no reason to have time for automation?

Google Earth engine (GEE) - tasks upgrade enables run all to download all images in task types with one click
How to send a reliable request before closing the page

Tla+ introductory tutorial (1): introduction to formal methods

Mongodb aggregation operation summary

Hit the core in the advanced area of misc in the attack and defense world
随机推荐
10 schemes to ensure interface data security
Redis的持久化机制
关于栈区、堆区、全局区、文字常量区、程序代码区
[the 2023 autumn recruitment of MIHA tour] open [the only exclusive internal push code of school recruitment eytuc]
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
攻防世界 MISC 进阶区 Erik-Baleog-and-Olaf
Google Earth Engine(GEE)——以MODIS/006/MCD19A2为例批量下载逐天AOD数据逐天的均值、最大值、最小值、标准差、方差统计分析和CSV下载(北京市各区为例)
Google Earth Engine(GEE)——Tasks升级,实现RUN ALL可以一键下载任务类型中的所有影像
Taobao commodity review API interface (item_review get Taobao commodity review API interface), tmall commodity review API interface
PMO: compare the sample efficiency of 25 molecular optimization methods
Lost in the lock world of MySQL
String类中的常用方法
攻防世界 misc 高手进阶区 a_good_idea
攻防世界 MISC 进阶 glance-50
Google Earth Engine(GEE)——基于 MCD64A1 的 GlobFire 日常火灾数据集
Sword finger offer 67 Convert a string to an integer
Logo Camp d'entraînement section 3 techniques créatives initiales
How can enterprises cross the digital divide? In cloud native 2.0
LOGO特训营 第四节 字体设计的重要性
Google Earth engine (GEE) - tasks upgrade enables run all to download all images in task types with one click