VIM how to suround each element in a list with quote and comma
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.
精彩评论