How to generate a number sequence in file using vi or Vim?

前端 未结 10 2046
野趣味
野趣味 2020-12-07 09:47

Is there a way to generate a number sequence in vi or Vim?

For example, for an arbitrary range of lines i  through j (where i < j

10条回答
  •  轮回少年
    2020-12-07 10:34

    Select several lines with V(Shift-v), then type command bellow:

    :let i=1 | '<,'>g/^/ s//\=i . " "/ | let i+=2
    

    Type :help sub-replace-expression to read more.

提交回复
热议问题