我正在重写一些脚本。我想附加到许多这样的行:
short=s[
verylongword=s[
P=s[
这些数字:
0
1
2
要得到这个:
short=s[0
verylongword=s[1
P=s[2
我已经尝试过使用 VIM ctrl+v put 我不能将它们放在行尾......如果无法使用 vim,即使使用 emacs,这是最好的方法......
编辑:
现在我知道我可以用 this method 来做,如果我在我的例子中的列中有数字,所以问题是如何在不先写序列的情况下更快地附加数字序列?
最佳答案
使用 vim,您可以使用以下搜索和替换语句
%s/$/\=line('.')-1
分解
% apply to entire buffer
s substitute
/$ search for end of line
/\=line('.')-1 replace with linenumber - 1
关于vim - 如何在不同长度的多行末尾附加数字序列?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20443993/