Keymaps: Add keymapsOnEvent to load keymap on specified events (#1260)

This commit is contained in:
Bodleum 2024-03-18 19:41:12 +00:00 committed by GitHub
parent f876a0a2e9
commit 303b9ca2c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 97 additions and 19 deletions

View file

@ -44,4 +44,38 @@
}
];
};
mkKeymapsOnEvents = {
keymapsOnEvents = {
"InsertEnter" =
helpers.keymaps.mkKeymaps
{
mode = "x";
options.silent = true;
}
[
{
mode = "n";
key = ",";
action = "<cmd>echo \"test\"<cr>";
}
{
# raw action using rawType
key = "<C-p>";
action.__raw = "function() print('hello') end";
}
{
key = "<C-a>";
action = "function() print('toto') end";
lua = true;
options.silent = false;
}
{
mode = ["n" "v"];
key = "<C-z>";
action = "bar";
}
];
};
};
}