modules/input: add options to configure leaders
This commit is contained in:
parent
c4cc7d5a80
commit
85f2524196
1 changed files with 24 additions and 9 deletions
|
@ -7,6 +7,17 @@ let
|
|||
in
|
||||
{
|
||||
options.input = with lib; with types; {
|
||||
leader = mkOption {
|
||||
type = str;
|
||||
default = ''\'';
|
||||
apply = x: assert (builtins.stringLength x == 1 || abort "<Leader> `${x}` is longer than one character is not allowed"); x;
|
||||
};
|
||||
localLeader = mkOption {
|
||||
type = str;
|
||||
default = ''\'';
|
||||
apply = x: assert (builtins.stringLength x == 1 || abort "<LocalLeader> `${x}` is longer than one character is not allowed"); x;
|
||||
};
|
||||
|
||||
exMode.enable = (mkEnableOption "Ex mode") // { default = true; };
|
||||
arrowKeys = {
|
||||
disableInMode = mkOption {
|
||||
|
@ -22,7 +33,10 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
config.vim.keymap.set =
|
||||
config = {
|
||||
vim.g.mapleader = cfg.leader;
|
||||
|
||||
vim.keymap.set =
|
||||
# Disable the annoying and useless ex-mode
|
||||
lib.optionals (!cfg.exMode.enable) (disableKeymaps "n" [ "Q" "gQ" ])
|
||||
# Disable arrow keys
|
||||
|
@ -31,4 +45,5 @@ in
|
|||
# Disable PageUp / PageDown
|
||||
++ lib.optionals (cfg.pageButtons.disableInMode != [ ])
|
||||
(disableKeymaps cfg.pageButtons.disableInMode [ "<PageUp>" "<PageDown>" ]);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue