假设我有以下文字:
key:value1 key:value234 key:val0
key:val1 key:value1 key:value5
key:value65799 key:value356 key:3790
是否有可能以某种方式将其转换为某种对齐的列?
key:value1 key:value234 key:val0
key:val1 key:value1 key:value5
key:value65799 key:value356 key:3790
当然,我可以用制表符替换分隔空格,但仅此一点没有帮助......
答案 0 :(得分:2)
我通常首先将空格转换为#,然后使用Align基于#对齐,然后删除#。
:%s/\ /#/g
:'<,'>Align#
:%s/\ /#/g
结果如下。
key:value1 key:value234 key:val0
key:val1 key:value1 key:value5
key:value65799 key:value356 key:3790
答案 1 :(得分:2)
在类Unix系统上:
:%!column -t
答案 2 :(得分:2)