modules/keymaps: fix bug in keymaps generation (#300)

This commit is contained in:
Gaétan Lepage 2023-04-04 18:34:05 +02:00 committed by GitHub
parent 90d14f97d4
commit bd81037c5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 119 additions and 106 deletions

View file

@ -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: