nvim-libmodal/examples/supress-exit.vim
2020-08-27 12:10:01 -04:00

16 lines
424 B
VimL
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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