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

1万+

被折叠的 条评论
为什么被折叠?



