diff options
| author | jdhao <jdhao@hotmail.com> | 2021-08-07 21:48:28 +0800 |
|---|---|---|
| committer | jdhao <jdhao@hotmail.com> | 2021-08-07 21:48:28 +0800 |
| commit | f690cdbf1d6d21e0bef3a19c3e563bddb88d83cf (patch) | |
| tree | 70f6059735ca054da2b3301d6fed3e87f8dd32c9 /autoload/utils.vim | |
| parent | 7ecfdda8ff29d6e896b9a0c20cbfd89a6f31d1ab (diff) | |
Better way to call lua function inside vim script
Diffstat (limited to 'autoload/utils.vim')
| -rw-r--r-- | autoload/utils.vim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/autoload/utils.vim b/autoload/utils.vim index b88e25f..900069c 100644 --- a/autoload/utils.vim +++ b/autoload/utils.vim @@ -45,8 +45,8 @@ endfunction " adapted from https://stackoverflow.com/a/12739441/6064933 function! utils#RandInt(Low, High) abort " Use lua to generate random int. It is faster. Ref: https://stackoverflow.com/a/20157671/6064933 - call luaeval('math.randomseed(os.time())') - return luaeval(printf('math.random(%s, %s)', a:Low, a:High)) + call v:lua.math.randomseed(localtime()) + return v:lua.math.random(a:Low, a:High) endfunction " Custom fold expr, adapted from https://vi.stackexchange.com/a/9094/15292 |
