当前位置:网站首页>1、编辑利器vim
1、编辑利器vim
2022-07-02 11:21:00 【Little BigUs】
VIM
vim有编辑模式和命令模式,编辑模式下输入什么就是什么,命令模式下通过特定的键可以实现特定的功能。
刚进入vim就是命令模式,在命令模式下按 i(在当前光标处插入)、a(在光标之后插入)、o(在光标当前行的下一行插入)
就可以进入插入模式。在插入模式下按ESC退出插入模式进入命令模式。
命令模式下:
:w
保存:q
退出:wq
保存并退出:q!
强制退出,不保存u
撤销 ,这个很有用Ctrl + r
反撤销,这个也很有用
接下来的东西有点绕,是关于复制粘贴的,也很重要。
小写v进入单个选中模式,也就是一个字符一个字符的选中,大写V进入行 选中模式,也就是一行一行的选中,选中之后可以进行复制,按下y进行复制,复制后 按 p进行粘贴。
也可以直接按 yy 复制当前行,无需选中,按nyy复制包括当前行的n行。
yw复制一个单词,nyw复制n个单词。
剪切:
剪切选中部分 :d
剪切一行:dd
剪切n行:ndd
剪切一个单词、剪切n个单词…
查找某一个单词: 斜杠/ + 要查找的单词 ,会找到文件第一个符合条件的单词并高亮显示,按下回车,光标定位到高亮显示的区域。此时按 小写n会定位到下一个该单词,大写N定位到上一个该单词。
如果想要把文件中所有的某个单词替换成另一个单词,操作如下::%s/被替换的单词/新单词
其中%s代表整个文件的意思,表示替换范围。如果只想替换某些行,例如我想替换n,m之间的单词,则应该将%
换成n,m
注意一定要是小写s。
:800
直接定位到800行
ctrl+d
向下翻页
ctrl+u
向上翻页
大写G直接定位到文件末尾,两个小写的g直接定位到文件开头,当然:1也是一样的效果。
21
13
边栏推荐
- Packet capturing tool Fiddler learning
- P1042 [noip2003 popularization group] Table Tennis
- Selenium element positioning method
- Who is better, Qianyuan projection Xiaoming Q1 pro or Jimi new play? Which configuration is higher than haqu K1?
- Word frequency statistics & sorting
- TeamTalk源码分析之win-client
- Tencent cloud tstor unified storage passed the evaluation of the first batch of basic file storage capabilities of the ICT Institute
- 一般来讲,如果频繁出现inconsistent tab and space的报错
- Multi rotor aircraft control using PID and LQR controllers
- 途家木鸟美团夏日折扣对垒,门槛低就一定香吗?
猜你喜欢
Design and implementation of car query system based on php+mysql
Fabric. JS upper dash, middle dash (strikethrough), underline
Pycharm连接远程服务器
万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单
c# 水晶报表打印
测试框架TestNG的使用(二):testNG xml的使用
[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)
Custom events, global event bus, message subscription and publishing, $nexttick
Default slot, named slot, scope slot
Do you know that there is an upper limit on the size of Oracle data files?
随机推荐
Method of creating linked server for cross server data access
腾讯云 TStor 统一存储通过信通院首批文件存储基础能力评测
自定义事件,全局事件总线,消息订阅与发布,$nextTick
Multi rotor aircraft control using PID and LQR controllers
Yolov3 & yolov5 output result description
Adhere to the foundation of 20 minutes go every day II
In 2021, the global TCB adapter revenue was about $93 million, and it is expected to reach $315.5 million in 2028
默认插槽,具名插槽,作用域插槽
BeanUtils -- shallow copy -- example / principle
MySQL 45 lecture - learning from the actual battle of geek time MySQL 45 Lecture Notes - 04 | easy to understand index (Part 1)
篇9:XShell免费版安装
The use of TestNG, the testing framework (II): the use of TestNG XML
Fabric.js 缩放画布
Golang 快速生成数据库表的 model 和 queryset
[development environment] StarUML tool (download software | StarUML installation | StarUML creation project)
Openharmony notes --------- (4)
HMS core machine learning service helps zaful users to shop conveniently
The global special paper revenue in 2021 was about $27 million, and it is expected to reach $35 million in 2028. From 2022 to 2028, the CAGR was 3.8%
Understanding of mongodb
Fabric. JS manual bold text iText