vi または Vim で数列を生成する方法はありますか?
たとえば、Vim で開いたファイル の行i から j (ここでi < j ) の任意の範囲について、行iの番号 1 から番号 ( j − <em >i + 1) 行 j ?
ファイルに次の行があるとします。
this is line #1
this is line #2
this is line #3
this is line #4
this is line #5
this is line #6
this is line #7
this is line #8
this is line #9
this is line #10
4 行目から 8 行目までの数列の前に 1 から 5 の数字を付けたいと思います。操作後、結果のファイルは次のようになります。
this is line #1
this is line #2
this is line #3
1 this is line #4
2 this is line #5
3 this is line #6
4 this is line #7
5 this is line #8
this is line #9
this is line #10
これが可能な場合、生成されたシーケンスに異なるステップ サイズを使用する方法はありますか? たとえば、結果のシーケンスが 2、4、6、8 などになるように、代わりにステップ サイズに 2 を使用できますか?
注:「<a href="https://stackoverflow.com/questions/252766/add-line-numbers-in-vim">Vim の行の範囲に行番号を追加する方法は?」という質問 同様の問題が発生しますが、同じではありません。