vim: add "1", -"10", and modify numbers +1

本文介绍如何在Vim编辑器中进行批量操作,包括范围内的数字替换、使用正则表达式修改数字、以及通过不同方法实现数字的递增。文章提供了具体的Vim命令示例,如使用range命令、正则表达式替换和数字运算。

1.rang(1,10)

2.s to replace

 

 

:s/^/\=range(1,10)

and then:

 

:1,10s/^/"/g

next: g is unnecessary

:1,10s/$/",/

 

you want change the range to 51-60

each num = num+50

%s/\d\+/\=submatch(0)+50/

 

and you can use another methold to try:

write a temp number :

"60",

yy

10 p

 

:let i=60 |g/60/s//\=i/|let i=i+2

then:

 

 

some links:

https://blog.csdn.net/zengchongxu/article/details/51336643vim 下把所有数字替换为 "数字"。

https://blog.csdn.net/joe_007/article/details/8308920

https://blog.csdn.net/hylaking/article/details/80270763 vi/vim的巧妙使用-数值加减,递增(转),序列等

 

vim(gvim)正则表达式查找替换(4)-生成连续数字或行号

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值