Created
December 22, 2015 03:20
-
-
Save note103/c8ebd2b311d7a206cb5f to your computer and use it in GitHub Desktop.
行頭に連番を振る
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| my @array = <DATA>; | |
| my $n = 1; | |
| for my $line (@array) { | |
| print "$n: $line"; | |
| $n++; | |
| } | |
| __DATA__ | |
| apple | |
| orange | |
| lemon | |
| grape |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:put=range(1,5)とVimのコマンドラインで実行すると、という5行が挿入されます。それらを矩形選択でコピーしておいて、
↑の1行目、大文字
Tのところにカーソルをあてた状態でPで貼り付けると、という具合で、冒頭に連番が振れました。矩形選択コピーしたものを
Pで行頭に貼り付け、ちょいちょい使ってます。