modules/input: use lib.mod instead
This commit is contained in:
parent
88190d31a9
commit
8fe5adc810
1 changed files with 7 additions and 5 deletions
|
@ -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 = "<nop>"; });
|
||||
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 "<Leader> `${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 "<LocalLeader> `${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 [ "<Up>" "<Down>" "<Left>" "<Right>" ])
|
||||
(disableKeymaps cfg.arrowKeys.mode [ mod.up mod.down mod.left mod.right ])
|
||||
# Disable PageUp / PageDown
|
||||
++ lib.optionals cfg.pageButtons.disable
|
||||
(disableKeymaps cfg.pageButtons.mode [ "<PageUp>" "<PageDown>" ]);
|
||||
(disableKeymaps cfg.pageButtons.mode [ mod.pageUp mod.pageDown ]);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue