function! Rand(max) redir @b ruby << EOF rmax = VIM::evaluate("a:max") rmax = nil if rmax == "" printf rand(rmax).to_s EOF redir END let @a = strpart(@a, 0, strlen(@a) - 1) let @b = strpart(@b, 1, strlen(@b) - 1) let @c = @a . @b return @c endfunction

fun! RandTable(...) for y in range(a:2) for x in range(a:1) if a:0 > 2 let rand = Rand(a:3) else let rand = Rand(10) end exe "norm i" . rand . " " endfor exe "norm Xi<cr>" endfor endfun

command! -nargs=* Rand call RandTable()

Built With

Share this project:

Updates

Submission history