2020-05-08 17:18:01 +00:00
|
|
|
local api = vim.api
|
|
|
|
local libmodal = require('libmodal')
|
2020-05-15 02:12:15 +00:00
|
|
|
local fooModeInputHistory = {}
|
2020-05-08 17:18:01 +00:00
|
|
|
|
|
|
|
local function clearHistory(indexToCheck)
|
2020-05-15 02:12:15 +00:00
|
|
|
if #fooModeInputHistory >= indexToCheck then
|
|
|
|
fooModeInputHistory = {}
|
2020-05-08 17:18:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-05-15 02:12:15 +00:00
|
|
|
function fooMode()
|
|
|
|
fooModeInputHistory[#fooModeInputHistory + 1] = string.char(
|
|
|
|
api.nvim_get_var('fooModeInput')
|
2020-05-13 22:22:25 +00:00
|
|
|
)
|
2020-05-08 17:18:01 +00:00
|
|
|
|
|
|
|
local index = 1
|
2020-05-15 02:12:15 +00:00
|
|
|
if fooModeInputHistory[1] == 'z' then
|
|
|
|
if fooModeInputHistory[2] == 'f' then
|
|
|
|
if fooModeInputHistory[3] == 'o' then
|
2020-05-08 17:18:01 +00:00
|
|
|
api.nvim_command("echom 'It works!'")
|
|
|
|
else index = 3 end
|
|
|
|
else index = 2 end
|
|
|
|
end
|
|
|
|
|
|
|
|
clearHistory(index)
|
|
|
|
end
|
|
|
|
|
2020-05-15 02:12:15 +00:00
|
|
|
libmodal.mode.enter('FOO', fooMode)
|