lib/keymaps: replace modes attrs with list

Simplify and remove dead code. Replace the `desc` attrs with inline
comments.
This commit is contained in:
Matt Sturgeon 2025-02-15 13:35:19 +00:00
parent d542e373f1
commit a1e168a2a0
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299

View file

@ -25,39 +25,21 @@ rec {
buffer = defaultNullOpts.mkBool false "Make the mapping buffer-local. Equivalent to adding `<buffer>` to a map."; buffer = defaultNullOpts.mkBool false "Make the mapping buffer-local. Equivalent to adding `<buffer>` to a map.";
}; };
modes = { modes = [
normal.short = "n"; "" # normal, visual, select, and operator-pending (same as plain ':map')
insert.short = "i"; "n" # normal
visual = { "!" # insert and command-line
desc = "visual and select"; "i" # insert
short = "v"; "c" # command
}; "v" # visual and select
visualOnly = { "x" # visual only
desc = "visual only"; "s" # select
short = "x"; "o" # operator-pending
}; "t" # terminal
select.short = "s"; "l" # insert, command-line and lang-arg
terminal.short = "t"; ];
normalVisualOp = {
desc = "normal, visual, select and operator-pending (same as plain 'map')";
short = "";
};
operator.short = "o";
lang = {
desc = "normal, visual, select and operator-pending (same as plain 'map')";
short = "l";
};
insertCommand = {
desc = "insert and command-line";
short = "!";
};
command.short = "c";
};
modeEnum = modeEnum = lib.types.enum modes;
lib.types.enum
# ["" "n" "v" ...]
(map ({ short, ... }: short) (lib.attrValues modes));
mapOptionSubmodule = mkMapOptionSubmodule { }; mapOptionSubmodule = mkMapOptionSubmodule { };