开发者

VIM how to suround each element in a list with quote and comma

开发者 https://www.devze.com 2023-01-29 21:44 出处:网络
say I have a list 1M 3M 5D 3Y 9Y I want to quickly turn this list into \"1M\", \"3M\", \"5D\", \"3Y\", \"9Y\" using vim -- so far I was开发者_如何学运维 doing it manually. thanks:%s/[^ ]\\+/\"&

say I have a list

1M 3M 5D 3Y 9Y

I want to quickly turn this list into "1M", "3M", "5D", "3Y", "9Y" using vim -- so far I was开发者_如何学运维 doing it manually. thanks


:%s/[^ ]\+/"&",/gc replaces tokens by "token",. c is for confirmation.


You can use surround plugin with macros.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号