2020-05-17 21:02:10 +00:00
|
|
|
" SUMMARY:
|
|
|
|
" * Runs the nvim-libmodal command prompt loop. The function takes an optional
|
|
|
|
" argument specifying how many times to run (runs until exiting by default).
|
|
|
|
" PARAMS:
|
|
|
|
" * `a:1` => `modeName`
|
2022-04-25 21:59:33 +00:00
|
|
|
" * `a:2` => `modeCallback` OR `modeKeymaps`
|
2020-05-17 21:02:10 +00:00
|
|
|
" * `a:3` => `supressExit`
|
|
|
|
function! libmodal#Enter(...) abort
|
|
|
|
call libmodal#_lua('mode', a:000)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
" SUMMARY:
|
|
|
|
" * Runs the nvim-libmodal command prompt loop. The function takes an optional
|
|
|
|
" argument specifying how many times to run (runs until exiting by default).
|
|
|
|
" PARAMS:
|
|
|
|
" * `a:1` => `modeName`
|
|
|
|
" * `a:2` => `modeCallback` OR `modeCommands`
|
|
|
|
" * `a:3` => `modeCompletions`
|
|
|
|
function! libmodal#Prompt(...) abort
|
2020-05-21 05:07:22 +00:00
|
|
|
call libmodal#_lua('prompt', a:000)
|
2020-05-17 21:02:10 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
" SUMMARY:
|
|
|
|
" * Pass arguments to an nvim-libmodal `enter()` command at the specified
|
|
|
|
" `lib` path.
|
|
|
|
" PARAMS:
|
|
|
|
" * `lib` => the name of the library.
|
|
|
|
" * 'mode" or 'prompt'.
|
|
|
|
" * `args` => the arguments to pass to `lib`.enter()
|
|
|
|
function! libmodal#_lua(lib, args)
|
|
|
|
call luaeval(
|
2020-05-20 22:45:32 +00:00
|
|
|
\ 'require("libmodal").' . a:lib . '.enter(_A[1], _A[2], _A[3])',
|
2020-05-17 21:02:10 +00:00
|
|
|
\ [
|
|
|
|
\ a:args[0],
|
|
|
|
\ a:args[1],
|
2020-05-24 23:32:13 +00:00
|
|
|
\ get(a:args, 2, v:null)
|
2020-05-17 21:02:10 +00:00
|
|
|
\ ]
|
|
|
|
\)
|
|
|
|
endfunction
|