From ccce2d8cb471323ef5e4e3ebf916032f7898c65c Mon Sep 17 00:00:00 2001 From: Iron-E Date: Fri, 15 Mar 2024 18:49:37 -0400 Subject: [PATCH] docs(examples): test CursorMoved, TextChanged events --- examples/lua/keymaps.lua | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/lua/keymaps.lua b/examples/lua/keymaps.lua index 895527a..7f39edd 100644 --- a/examples/lua/keymaps.lua +++ b/examples/lua/keymaps.lua @@ -13,18 +13,31 @@ local fooModeKeymaps = j = 'norm j', k = 'norm k', l = 'norm l', + G = function(self) local count = self.count:get() vim.api.nvim_command('norm! ' .. count .. 'G') end, + + d = 'delete', + e = 'edit foo', + o = 'norm o', + p = 'bp', + zf = 'split', zfc = 'q', zff = split_twice, zfo = 'vsplit', - e = 'edit foo', - p = 'bp', - o = 'norm o', } +-- show that events work as expected +local id = vim.api.nvim_create_autocmd( + { 'CursorMoved', 'CursorMovedI', 'TextChanged', 'TextChangedI', 'TextChangedP', 'TextChangedT' }, + { callback = function(ev) vim.notify(vim.inspect(ev)) end } +) + -- enter the mode using the keymaps libmodal.mode.enter('FOO', fooModeKeymaps) + +-- remove setup +vim.api.nvim_del_autocmd(id)