如何通过Vim在文本文档中每行的末尾添加自动递增编号?
假设我有以下文件:
some_text
other_text
another_text
预期产量:
some_text 1
other_text 2
another_text 3
您可以使用expression来代替:
:%s/$/\=' '.line('.')/
键入:help :s\=
在vim以了解详情。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句