当前位置:网站首页>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:向下新起一行进行插入
边栏推荐
猜你喜欢

Count the six weapons of the domestic interface cooperation platform!

Talk about the new trend of machine translation, and the second maverick translation forum is about to open

Understanding service governance in distributed development

Following the example of IE, is the decline of Firefox inevitable?

20 years ago, he was Ma Yun's biggest enemy

Introduction to Alibaba eagle eye system

Gods at dusk, "cat trembles" bid farewell to the big V Era

Neural network implementation of handwritten numeral classification matlab

Coca Cola's primary challenge is not vitality forest

Behind every piece of information you collect, you can't live without TA
随机推荐
[OBS] newsocketloopenable network optimization
Count the six weapons of the domestic interface cooperation platform!
anaconda重新卸载
Introduction to cue language foundation: cue is a language born for configuration
js实现右键菜单栏功能
kubernetes 1.24高可用集群二进制部署
JDBC连接数据库读取前台无法显示数据
Database hyperphone (4)
Behind every piece of information you collect, you can't live without TA
选择体育场馆的LED显示屏时应该注重哪些方面
Fast analysis combined with Haidian medicine
诸神黄昏,“猫抖快”告别大V时代
Kubernetes Part 7: using kubernetes to deploy prometheus+grafana monitoring system (kubernetes work practice class)
Introduction to Alibaba eagle eye system
ACL 2022 | prompt based automatic depolarization: effectively reducing bias in the pre training language model
numpy数组矩阵操作
微信小程序 实现位置地图显示,引入map地图,不含导航
【数据库系统概论(王珊)】第1章——绪论
【单片机】2.1 AT89S52单片机的硬件组成
Chen Yili of ICT Institute: reducing cost and increasing efficiency is the greatest value of cloud native applications