nvim-libmodal/examples/lua/key-combos-supress-exit.lua

15 lines
387 B
Lua
Raw Normal View History

2020-08-27 16:10:01 +00:00
-- Imports
local libmodal = require('libmodal')
2020-08-27 16:10:01 +00:00
-- Register key commands and what they do.
2020-05-15 02:12:15 +00:00
local fooModeCombos = {
[''] = 'echom "You cant exit using escape."',
2020-05-15 02:12:15 +00:00
['q'] = 'let g:fooModeExit = 1'
}
2020-08-27 16:10:01 +00:00
-- Tell the mode not to exit automatically.
2020-05-15 02:12:15 +00:00
vim.api.nvim_set_var('fooModeExit', 0)
2020-08-27 16:10:01 +00:00
-- Enter the mode using the key combos created before.
2020-05-15 02:12:15 +00:00
libmodal.mode.enter('FOO', fooModeCombos, true)