当前位置:网站首页>vim 常用快捷键
vim 常用快捷键
2022-07-23 19:17:00 【向着百万年薪努力的小赵】
光标操作
gg:移动到文件头部位置
G:移动到文件末尾
nG:移动到 n 行,10G 即移动到文件第十行
$:跳转到当前行末尾
^:跳转到当前行开头
w:向右移动一个单词
nw:向右移动多个单词
b:向左移动一个单词
nb:向左移动多个单词
ggvG:全选
文本操作
dd:删除本行
ndd :删除 n 行
yy:复制当前行
p:粘贴
a:进入编辑模式,插入内容位置在光标的后面
复制此文件所有内容:
- ggvG 全选 + y 复制 + p 粘贴
复制多行:
- v 进入可视模式,通过移动光标选择目标,按 y 复制,p 粘贴
- 输入: 进入命令行模式,输入 15 20 copy 21, 即将从第十五行到第二十行的内容从第二十一行开始复制
查找与替换
查找:
- 在普通模式下输入 /,即可开始查找。
- 例如查找 root,输入 /root按下 enter 即可跳转至 root第一次出现的位置,同时,输入 n 可跳转至下一个 root 的位置,输入 N 跳转至上一个的位置
替换:
- : s/root/admin/ 将光标当前行第一个出现的 root 替换为 admin,没有则不替换
- : s/root/admin/g 将光标当前行的所有的 root 替换为 admin
- : 3,5 s/root/admin/g 将第三至五行所有的 root 替换为 admin
- : %s/root/admin/g 将所有行的 root 替换为 admin
保存与退出
- :q! 不保存退出
- :wq 保存并退出
- :x 保存并退出
- :w 保存
- :w b.txt 另存为 b.txt
边栏推荐
- Adobe Acrobat two powerful plug-ins
- 重装系统后故障(报错:reboot and select proper boot deviceor insert boot media in selected boot device)
- Training log on July 22, 2022
- 20.ref与props
- 多子系统多业务模块的复杂数据处理——基于指令集物联网操作系统的项目开发实践
- 小程序頭像組樣式
- Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 4
- MySQL master-slave replication
- Leetcode 219. duplicate Element II exists (yes, resolved)
- [深入研究4G/5G/6G专题-40]: URLLC-11-《3GPP URLLC相关协议、规范、技术原理深度解读》-5-5G Qos原理与架构: 切片、PDU会话、QosFlow、5QI、DRB
猜你喜欢
随机推荐
Redux summation case explanation version tutorial
Win11没有Word文档怎么办?Win11没有Word文档解决教程
C language leak detection and filling (1)
The numerical sequence caused by the PostgreSQL sequence cache parameter is discontinuous with interval gap
Leetcode 238. 除自身以外数组的乘积
next数值型数据类型()出现输入错误后,下次依然能正常输入
Energy principle and variational method note 19: minimum complementary energy principle + possible work principle
Osgearth2.8 compiling silvering cloud effect
osgearth使用sundog公司的triton海洋和silverlining云彩效果
BM14 链表的奇偶重排
Baidu map data visualization
Detailed writing process of impala
【ASP.NET Core】选项模式的相关接口
Chinese [easy to understand] cannot be set when installing SVN localization package
2022DASCTF MAY
Leetcode 151. 颠倒字符串中的单词
Leetcode 209. subarray with the smallest length
17. Life cycle
What if there is no word document in win11? There is no word document solution tutorial in win11
Odrive application 6 encoder









