Add support for mappings

This commit is contained in:
Pedro Alves 2021-01-05 16:11:56 +00:00
parent 7122ccd208
commit 0586bed5ad
7 changed files with 142 additions and 14 deletions

View file

@ -27,4 +27,28 @@ rec {
else if isNull args then
"nil"
else "";
# 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;
script = false;
nowait = false;
action = action;
}
else 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;
};
key = key;
mode = mode;
}) normalized);
}