Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " List Generator
- " Barry Arthur, Jan 2012
- " List(count, start, step)
- " count : number of list items (lines) to generate
- " start : starting number at head of list (default: 1)
- " step : increment for each successive line (default: 1)
- function! List(cnt, ...)
- let val = 1
- let inc = 1
- if a:0 > 0
- let val = a:1
- if a:0 > 1
- let inc = a:2
- endif
- endif
- exe "normal! " . a:cnt . "o"
- exe "'[,']s/^/\\=(((line('.')-line(\"'[\")+1)*inc)-(inc-val))/"
- endfunction
- command! -nargs=+ List call List(<f-args>)
- finish
- " examples:
- "
- " :List 5
- "1
- "2
- "3
- "4
- "5
- "
- " :List 5 3
- "3
- "4
- "5
- "6
- "7
- "
- " :List 5 3 4
- "3
- "7
- "11
- "15
- "19
- "
- " :List 5 4 3
- "4
- "7
- "10
- "13
- "16
- "
- " :List 5 101 101
- "101
- "202
- "303
- "404
- "505
Advertisement
Add Comment
Please, Sign In to add comment