mirror of
https://github.com/nix-community/nixvim.git
synced 2025-08-03 17:45:03 +02:00
modules/keymaps: refactor + new syntax
This commit is contained in:
parent
382973b627
commit
574fb73258
6 changed files with 716 additions and 521 deletions
|
@ -1,5 +1,72 @@
|
|||
{
|
||||
example = {
|
||||
{helpers, ...}: {
|
||||
legacy = {
|
||||
maps.normal."," = "<cmd>echo \"test\"<cr>";
|
||||
};
|
||||
|
||||
legacy-mkMaps = {
|
||||
maps = helpers.mkMaps {silent = true;} {
|
||||
normal."," = "<cmd>echo \"test\"<cr>";
|
||||
visual = {
|
||||
"<C-a>" = {
|
||||
action = "function() print('toto') end";
|
||||
lua = true;
|
||||
silent = false;
|
||||
};
|
||||
"<C-z>" = {
|
||||
action = "bar";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
legacy-mkModeMaps = {
|
||||
maps.normal = helpers.mkModeMaps {silent = true;} {
|
||||
"," = "<cmd>echo \"test\"<cr>";
|
||||
"<C-a>" = {
|
||||
action = "function() print('toto') end";
|
||||
lua = true;
|
||||
silent = false;
|
||||
};
|
||||
"<leader>b" = {
|
||||
action = "bar";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
example = {
|
||||
keymaps = [
|
||||
{
|
||||
key = ",";
|
||||
action = "<cmd>echo \"test\"<cr>";
|
||||
mode = ["n" "s"];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mkMaps = {
|
||||
keymaps =
|
||||
helpers.mkKeymaps
|
||||
{
|
||||
mode = "x";
|
||||
options.silent = true;
|
||||
}
|
||||
[
|
||||
{
|
||||
mode = "n";
|
||||
key = ",";
|
||||
action = "<cmd>echo \"test\"<cr>";
|
||||
}
|
||||
{
|
||||
key = "<C-a>";
|
||||
action = "function() print('toto') end";
|
||||
lua = true;
|
||||
options.silent = false;
|
||||
}
|
||||
{
|
||||
mode = ["n" "v"];
|
||||
key = "<C-z>";
|
||||
action = "bar";
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue