mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
Better way to call lua function inside vim script
This commit is contained in:
parent
7ecfdda8ff
commit
f690cdbf1d
@ -45,8 +45,8 @@ endfunction
|
|||||||
" adapted from https://stackoverflow.com/a/12739441/6064933
|
" adapted from https://stackoverflow.com/a/12739441/6064933
|
||||||
function! utils#RandInt(Low, High) abort
|
function! utils#RandInt(Low, High) abort
|
||||||
" Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933
|
" Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933
|
||||||
call luaeval('math.randomseed(os.time())')
|
call v:lua.math.randomseed(localtime())
|
||||||
return luaeval(printf('math.random(%s, %s)', a:Low, a:High))
|
return v:lua.math.random(a:Low, a:High)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
" Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user