You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nvim-libmodal/examples/prompt-callback.vim

19 lines
567 B
VimL

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