mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-29 12:00:04 +02:00
modules/keymaps: fix bug in keymaps generation (#300)
This commit is contained in:
parent
90d14f97d4
commit
bd81037c5f
2 changed files with 119 additions and 106 deletions
|
@ -49,42 +49,6 @@ with lib; rec {
|
|||
|
||||
emptyTable = {"__empty" = null;};
|
||||
|
||||
# Generates maps for a lua config
|
||||
genMaps = mode: maps: let
|
||||
normalized =
|
||||
builtins.mapAttrs
|
||||
(key: action:
|
||||
if builtins.isString action
|
||||
then {
|
||||
silent = false;
|
||||
expr = false;
|
||||
unique = false;
|
||||
noremap = true;
|
||||
remap = false;
|
||||
script = false;
|
||||
nowait = false;
|
||||
action = action;
|
||||
}
|
||||
else {
|
||||
inherit (action) silent expr unique noremap script nowait remap;
|
||||
action =
|
||||
if action.lua
|
||||
then mkRaw action.action
|
||||
else action.action;
|
||||
})
|
||||
maps;
|
||||
in
|
||||
builtins.attrValues (builtins.mapAttrs
|
||||
(key: action: {
|
||||
action = action.action;
|
||||
config = lib.filterAttrs (_: v: v) {
|
||||
inherit (action) silent expr unique noremap script nowait remap;
|
||||
};
|
||||
key = key;
|
||||
mode = mode;
|
||||
})
|
||||
normalized);
|
||||
|
||||
# Given an attrs of key mappings (for a single mode), applies the defaults to each one of them.
|
||||
#
|
||||
# Example:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue