nvim-libmodal/examples/prompt-callback.vim

18 lines
538 B
VimL
Raw Normal View History

2020-08-27 16:10:01 +00:00
" This is the list of commands— used for auto completion.
2020-08-26 22:48:48 +00:00
let s:commandList = ['new', 'close', 'last']
2020-08-27 16:10:01 +00:00
" This function will be called whenever a command is entered.
2020-08-26 22:48:48 +00:00
function! s:fooMode() abort
let l:userInput = g:fooModeInput
if userInput == 'new'
tabnew
elseif userInput == 'close'
tabclose
elseif userInput == 'last'
tablast
endif
endfunction
2020-08-27 16:10:01 +00:00
" You have to convert s:commandList from a Vimscript list to a lua table using luaeval().
2020-08-26 22:48:48 +00:00
call luaeval("require('libmodal').prompt.enter('FOO', 's:fooMode', _A)", s:commandList)