当前位置:网站首页>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入门完整教程:Bitmaps
- Li Kou 98: verify binary search tree
- Solana chain application crema was shut down due to hacker attacks
- UML diagram memory skills
- Attack and defense world misc master advanced zone 001 normal_ png
- 9 - 类
- 集群的概述与定义,一看就会
- MYSQL架构——逻辑架构
- Sword finger offer 68 - I. nearest common ancestor of binary search tree
- Redis入门完整教程:键管理
猜你喜欢

攻防世界 MISC 进阶区 Erik-Baleog-and-Olaf

堆排序代码详解

LOGO特訓營 第三節 首字母創意手法

攻防世界 MISC 进阶区 can_has_stdio?

Wake up day, how do I step by step towards the road of software testing

Attack and defense world misc advanced area Hong

Redis入门完整教程:键管理

sobel过滤器

LOGO特訓營 第一節 鑒別Logo與Logo設計思路

Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
随机推荐
Mongodb aggregation operation summary
Logo special training camp section II collocation relationship between words and graphics
关于栈区、堆区、全局区、文字常量区、程序代码区
Google Earth engine (GEE) - globfire daily fire data set based on mcd64a1
How to manage 15million employees easily?
新版判断PC和手机端代码,手机端跳转手机端,PC跳转PC端最新有效代码
MD5 tool class
How can enterprises cross the digital divide? In cloud native 2.0
Google Earth engine (GEE) -- take modis/006/mcd19a2 as an example to batch download the daily mean, maximum, minimum, standard deviation, statistical analysis of variance and CSV download of daily AOD
SQL中MAX与GREATEST的区别
[roommate learned to use Bi report data processing in the time of King glory in one game]
Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
剑指 Offer 67. 把字符串转换成整数
Redis入门完整教程:Pipeline
In Linux, I call odspcmd to query the database information. How to output silently is to only output values. Don't do this
String类中的常用方法
Wake up day, how do I step by step towards the road of software testing
Attack and defense world misc advanced zone 2017_ Dating_ in_ Singapore
leetcode 72. Edit distance edit distance (medium)
The overview and definition of clusters can be seen at a glance