nvim-libmodal/examples/supress-exit.vim

16 lines
424 B
VimL
Raw Normal View History

2020-08-27 16:10:01 +00:00
" Function which is called every time the user presses a button.
function! s:fooMode() abort
let l:userInput = nr2char(g:fooModeInput)
2020-08-26 22:48:48 +00:00
2020-08-27 16:10:01 +00:00
if l:userInput == ''
echom 'You cant leave using <Esc>.'
elseif l:userInput == 'q'
let g:fooModeExit = v:true
endif
endfunction
2020-08-26 22:48:48 +00:00
2020-08-27 16:10:01 +00:00
" Tell the mode not to exit automatically.
let g:fooModeExit = v:false
" Begin the mode.
lua require('libmodal').mode.enter('FOO', 's:fooMode', true)