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/supress-exit.vim

16 lines
424 B
VimL

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

" 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)