I have a pretty long list, like so:
itemOne
itemTwo
,itemThree
itemFour
itemFive
,itemSix
,itemSeven
Each line that starts with a comma needs to be merged with the line above, like so:
itemOne
itemTwo,itemThree
itemFour
itemFive,itemSix,itemSeven
How can I do this?
一种有效的方法是使用以下:global
命令:
:g/^,/-j!
你可以这样做:
:%s/\n,/,/g
Try this substitution:
:%s#\n\ze,##
Explanation:
%s#
begin a substitution on all lines. \\n
match the newline character. \\ze,
set the end of the match before the comma so the comma will not be replaced. ##
replace with nothing (to remove the newline character).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.