43 lines
956 B
Nix
43 lines
956 B
Nix
{pkgs, ...}: let
|
|
inherit (pkgs.lib) fix mkOption types;
|
|
|
|
coerceStrToKeymap = mapping: {
|
|
inherit mapping;
|
|
mode = ["n"];
|
|
};
|
|
|
|
typeOrListOf = t: with types; coercedTo t (e: [e]) (listOf t);
|
|
|
|
modeType = types.enum ["n" "v" "s" "i" "o" "x"];
|
|
in
|
|
fix (self: {
|
|
module = types.submodule {
|
|
options = {
|
|
mode = mkOption {
|
|
type = typeOrListOf modeType;
|
|
default = "n";
|
|
example = "v";
|
|
description = ''
|
|
The mode of the keymap.
|
|
'';
|
|
};
|
|
|
|
mapping = mkOption {
|
|
type = typeOrListOf types.str;
|
|
example = "<C-n>";
|
|
description = ''
|
|
The actual keymap
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
option = mkOption {
|
|
type = with types; listOf (coercedTo str coerceStrToKeymap self.module);
|
|
default = [];
|
|
description = ''
|
|
List of keystrokes on which the plugin should be loaded
|
|
'';
|
|
};
|
|
})
|