mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-23 09:18:38 +02:00
Add support for mappings
This commit is contained in:
parent
7122ccd208
commit
0586bed5ad
7 changed files with 142 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue