Skip to content

Instantly share code, notes, and snippets.

@YasuakiHirano
Last active January 21, 2016 07:46
Show Gist options
  • Save YasuakiHirano/a5f7235b5f5b4e2a7ff8 to your computer and use it in GitHub Desktop.
Save YasuakiHirano/a5f7235b5f5b4e2a7ff8 to your computer and use it in GitHub Desktop.
command! -nargs=* StrCnt call s:StrCnt(<f-args>)
" def:文字列に連番を付ける
" param: str 文字列
" param: num 最大値
function! s:StrCnt(str, num)
let i = 0
let input = ""
while i < a:num
let input .= a:str.i."\n"
let i = i + 1
endwhile
let pos = getpos(".")
execute ":normal a" . input
call setpos('.', pos)
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment