当前位置:网站首页>vim的配置及基础使用
vim的配置及基础使用
2022-07-27 15:50:00 【Massachusetts_11】
1.vim的配置
默认的vim编辑器没有缩进,没有行号,界面丑……。
为了让大家尽快上手vim,这里用最简短的方法配置一个好用的vim(这里是一个针对c/cpp语法的vim编辑器配置)
将以下命令复制粘贴到你的linux,回车(注意:对于的vim配置,各个用户是独立的,且不能给root用户进行配置)
curl -sLf https://gitee.com/HGtz2222/VimForCpp/raw/master/install.sh -o ./install.sh && bash ./install.sh
输入root密码,回车
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jdCudCff-1658757027050)(image-20220725212310676.png)]
执行
source ~/.bashrc,回车[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-nUs1vyF2-1658757027051)(image-20220725212600317.png)]
2.vim的使用
方便起见,我们把vim共分为三种模式:命令模式、底行模式、插入模式


2.1命令模式:默认的模式
命令模式下,左下角会呈现此种字样
任意模式退回到命令模式:esc
2.1.1命令模式下的文本批量化操作
2.1.1.1基础操作:
复制一行:yy 复制3行:3yy
粘贴:p 粘贴3次 :3p
剪切:dd
撤销:u
还原:ctrl+r
2.1.1.2光标移动:
光标定位到结尾行:G 开头行:gg 光标快速定位到第3行:3G
定位到行的末尾:shift+4——$ 行首:shift+6——^
以单词为单位移动光标-后:w 前:b
上下左右:hjkl

2.1.1.3内容修改
将光标处的字母大小写反转:~
将光标处替换为x:rx 3个x:3rx
进入替换模式:R
删除单个字符:x 删除3个:3x
2.2底行模式:退出等操作
在命令模式下输入:进入底行模式
底行模式下,左下角会呈现此种状态
2.2.1底行模式的常见命令
退出:q
保存:w
保存并退出:wq
文本替换:s/xxxx/yyyyy/g(将全文的xxxx换成yyyyy)
确认:回车
2.3插入模式:修改内容
插入模式下,左下角会呈现此种状态
命令模式下输入i/a/o进入修改模式;
i:从光标位置插入
a:从光标的下一个位置
o:向下新起一行进行插入
img-JubRJleH-1658757027056)]
命令模式下输入i/a/o进入修改模式;
i:从光标位置插入
a:从光标的下一个位置
o:向下新起一行进行插入
边栏推荐
- 阿里巴巴鹰眼系统简介
- JDBC连接数据库读取前台无法显示数据
- Wechat applet cloud function batch delete multiple data error: errcode: -502005 database collection not exists
- 美团到餐“祖传数仓”标准化治理笔记
- How far can invisible orthodontics go under the tuyere?
- [MCU] 2.2 pin function of AT89S52
- MySQL view and stored procedure
- The 7-year-old boy broke his finger by AI robot just because he played chess too fast?
- Chen Yili of ICT Institute: reducing cost and increasing efficiency is the greatest value of cloud native applications
- 写好技术原创文章的一点建议
猜你喜欢

Explain the idempotence of distributed system in detail

Uncle's nephew and his students

js实现右键菜单栏功能

美团到餐“祖传数仓”标准化治理笔记

Hegong sky team vision training Day7 - vision, Jetson naon and d435i

Oracle 11g database installation tutorial

Chery omenda is also too similar to Chang'an uni-t, but does it look like it? Is the product power like it?

微信小程序 云函数批量删除多条数据 Error: errCode: -502005 database collection not exists

Switch and router technology-02-working principle of Ethernet switch

kubernetes 1.24高可用集群二进制部署
随机推荐
Switch and router technology-02-working principle of Ethernet switch
写好技术原创文章的一点建议
Wechat applet to make calls
Today's sleep quality record 82 points
Layout of flutter
How to learn C language? This article gives you the complete answer
Branch loop statement of C language
【数据库系统概论(王珊)】第1章——绪论
20 years ago, he was Ma Yun's biggest enemy
运行loam_velodyne实时建图
JDBC连接数据库读取前台无法显示数据
Database hyperphone (III)
Explain the pile of binary trees in detail
Database hyperphone (4)
【obs】x264_encoder_encode 编码输出pts dts和 framesize
Uncle's nephew and his students
Behind every piece of information you collect, you can't live without TA
Database hyperphone (I)
数据库超话(三)
Understanding service governance in distributed development