例如,我想合并这样的文本:
CATEGORIES = ['Books',
'Business',
'Education',
'Entertainment',
'Finance',
'Games',
'Healthcare & Fitness',
'Lifestyle',
'Medical',
'Music',
'Navigation',
'News',
'Photography',
'Productivity',
'Reference',
'Social Networking',
'Sports',
'Travel',
'Utilities',
'Weather',
'All', ]
进入
CATEGORIES = ['Books', 'Business', 'Education', 'Entertainment', 'Finance', 'Games', 'Healthcare & Fitness', 'Lifestyle', 'Medical', 'Music', 'Navigation', 'News', 'Photography', 'Productivity', 'Reference', 'Social Networking', 'Sports', 'Travel', 'Utilities', 'Weather', 'All', ]
最佳答案
在命令模式下:
[range]j[lines]
例如:这里您想要执行整个缓冲区:
%j
如果您只想从当前光标位置执行 10 行:
j10
如果您不想用空格替换新行,请在 j 之后使用 !。
%j!
j!10
对于 super 幻想:
5j20
它将转到第 5 行,并加入接下来的 20 行。
关于vim - 如何在 Vim 中将多行合并为一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6577508/