modules/keymaps: bind lua function calls (#178)

This commit is contained in:
Gaétan Lepage 2023-02-22 23:01:27 +01:00 committed by GitHub
parent b1bd19b1b5
commit a15c0543a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View file

@ -55,7 +55,13 @@ with lib; rec {
nowait = false; nowait = false;
action = action; action = action;
} }
else action) else {
inherit (action) silent expr unique noremap script nowait;
action =
if action.lua
then mkRaw action.action
else action;
})
maps; maps;
in in
builtins.attrValues (builtins.mapAttrs builtins.attrValues (builtins.mapAttrs

View file

@ -51,11 +51,18 @@ with lib; let
description = "The action to execute."; description = "The action to execute.";
}; };
description = mkOption { lua = mkOption {
type = types.nullOr types.str; type = types.bool;
description = "A textual description of this keybind, to be shown in which-key, if you have it."; description = ''
default = null; If true, `action` is considered to be lua code.
Thus, it will not be wrapped in `""`.
'';
default = false;
}; };
description = helpers.mkNullOrOption types.str ''
A textual description of this keybind, to be shown in which-key, if you have it.
'';
}; };
}) })
]; ];