diff --git a/modules/input.nix b/modules/input.nix index 136caac..4e37f09 100644 --- a/modules/input.nix +++ b/modules/input.nix @@ -1,21 +1,23 @@ { config, lib, ... }: let + inherit (lib) mod; + cfg = config.input; - disableKeymaps = mode: lhss: lib.flip map lhss (lhs: { inherit mode lhs; rhs = ""; }); + disableKeymaps = mode: lhss: lib.flip map lhss (lhs: { inherit mode lhs; rhs = mod.nop; }); in { options.input = with lib; { leader = mkOption { type = types.str; default = ''\''; - apply = x: assert (builtins.stringLength x == 1 || abort " `${x}` is longer than one character is not allowed"); x; + apply = x: assert (builtins.stringLength x == 1 || abort "${mod.leader} `${x}` is longer than one character is not allowed"); x; }; localLeader = mkOption { type = types.str; default = ''\''; - apply = x: assert (builtins.stringLength x == 1 || abort " `${x}` is longer than one character is not allowed"); x; + apply = x: assert (builtins.stringLength x == 1 || abort "${mod.localLeader} `${x}` is longer than one character is not allowed"); x; }; exMode.enable = mkEnableOption "Ex mode"; @@ -50,9 +52,9 @@ in lib.optionals (!cfg.exMode.enable) (disableKeymaps "n" [ "Q" "gQ" ]) # Disable arrow keys ++ lib.optionals cfg.arrowKeys.disable - (disableKeymaps cfg.arrowKeys.mode [ "" "" "" "" ]) + (disableKeymaps cfg.arrowKeys.mode [ mod.up mod.down mod.left mod.right ]) # Disable PageUp / PageDown ++ lib.optionals cfg.pageButtons.disable - (disableKeymaps cfg.pageButtons.mode [ "" "" ]); + (disableKeymaps cfg.pageButtons.mode [ mod.pageUp mod.pageDown ]); }; }