我的yaml文件:
colors
- black
- white
- red
- green
size
- big
- small
- medium
weight
- 100
- 200
- 300
Run Code Online (Sandbox Code Playgroud)
...
如何在不以" - "开头的每一行的末尾添加":"?
结果应该是这样的:
colors:
- black
- white
- red
- green
size:
- big
- small
- medium
weight:
- 100
- 200
- 300
Run Code Online (Sandbox Code Playgroud)
这应该工作:
:%v/^-/normal A:
Run Code Online (Sandbox Code Playgroud)
本着皮肤猫的精神(感谢为此带来一些幽默,romainl :)),
:v/^-/normal A:
:g/^[^-]/s/$/:/
Run Code Online (Sandbox Code Playgroud)