nvim-libmodal/examples/lua/supress-exit.lua
2020-05-14 22:12:15 -04:00

17 lines
385 B
Lua
Raw Permalink 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.

local libmodal = require('libmodal')
function fooMode()
local userInput = string.char(
vim.api.nvim_get_var('fooModeInput')
)
if userInput == '' then
vim.api.nvim_command("echom 'You cant leave using <Esc>.'")
elseif userInput == 'q' then
vim.api.nvim_set_var('fooModeExit', true)
end
end
vim.api.nvim_set_var('fooModeExit', 0)
libmodal.mode.enter('FOO', fooMode, true)