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.
-- Imports
localapi=vim.api
locallibmodal=require('libmodal')
-- Function which is called whenever the user presses a button
localfunctionfooMode()
-- Append to the input history, the latest button press.
localuserInput=string.char(
-- The input is a character number.
api.nvim_get_var('fooModeInput')
)
ifuserInput==''then
api.nvim_command("echom 'You cant leave using <Esc>.'")
elseifuserInput=='q'then
-- If the user presses 'q', libmodal will exit the mode.
api.nvim_set_var('fooModeExit',true)
end
end
-- Tell libmodal not to exit the mode immediately.