docs(examples): `*.switch`

pull/30/head
Iron-E 2 months ago
parent 7cc07a2988
commit ad9ed317e2
No known key found for this signature in database
GPG Key ID: 569E791B76A42A1A

@ -4,6 +4,10 @@ local k = vim.keycode or function(s)
return vim.api.nvim_replace_termcodes(s, true, true, true)
end
local barModeKeymaps = {
p = function() vim.notify('Hello!') end,
}
-- register key commands and what they do
local fooModeKeymaps =
{
@ -12,6 +16,10 @@ local fooModeKeymaps =
x = function(self)
self:exit() -- exits this instance of the mode
end,
y = function(self)
self:switch('Bar', barModeKeymaps) -- enters Bar and then exits Foo when it is done
end,
z = libmodal.mode.switch('Bar', barModeKeymaps), -- the same as above, but more convenience
}
-- tell the mode not to exit automatically

Loading…
Cancel
Save