我有自由文字
"starthello","hello
helloInline
helloInline2","hello2","new field"
"not this","no inline line breaks","no","no"
我想与"$^ "
加入
"starthello","hello helloInline helloInline2","hello2","new field"
"not this","no inline line breaks","no","no"
如何在Vim中加入内联换行符?
答案 0 :(得分:2)
你可以这样做:
:g/[^"]$/.,/"/j
以下是它的工作原理:
:g/ # On every line matching this regex:
[^"]$ # A line that does *not* end with a double quote
/ # Run this command:
., # On every line from the current line until
/"/ # The next line containing a double quote
# Run this command:
j # Join (remove newlines)
答案 1 :(得分:1)
可能还有其他方法可以做到这一点,但有一种方法是通过按Shift+V
并向上或向下移动光标来直观地选择要加入的行。然后按Shift + J
加入选定的行。