From ad9ed317e2a9a7dba200df98a119a2dc473118be Mon Sep 17 00:00:00 2001 From: Iron-E Date: Mon, 11 Mar 2024 14:52:11 -0400 Subject: [PATCH] docs(examples): `*.switch` --- examples/lua/keymaps-supress-exit.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/lua/keymaps-supress-exit.lua b/examples/lua/keymaps-supress-exit.lua index 844f9d0..5479459 100644 --- a/examples/lua/keymaps-supress-exit.lua +++ b/examples/lua/keymaps-supress-exit.lua @@ -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