modules/keymap: don't validate by buffer
This commit is contained in:
parent
688e8e2ece
commit
bc38ab74de
3 changed files with 5 additions and 10 deletions
|
@ -43,10 +43,9 @@ in
|
|||
# Keymaps
|
||||
(lib.flip map config.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars:
|
||||
let
|
||||
buf = lib.optionalString (vars.buffer != null) vars.buffer;
|
||||
m = if builtins.isList mode then lib.head mode else mode;
|
||||
in
|
||||
if config.vim.keymap._validate."${buf}"."${m}"."${lhs}" == rhs then vars.genConfig
|
||||
if config.vim.keymap._validate."${m}"."${lhs}" == rhs then vars.genConfig
|
||||
else abort "This case should never happen."
|
||||
))
|
||||
]));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{ lib, ... }:
|
||||
|
||||
let
|
||||
|
||||
fnOpts = { name, config, ... }: {
|
||||
options = with lib; {
|
||||
args = mkOption {
|
||||
|
@ -43,10 +42,9 @@ let
|
|||
|
||||
(lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars:
|
||||
let
|
||||
buf = lib.optionalString (vars.buffer != null) vars.buffer.raw;
|
||||
m = if builtins.isList mode then lib.head mode else mode;
|
||||
in
|
||||
if innerCfg.vim.keymap._validate."${buf}"."${m}"."${lhs}" == rhs then vars.genConfig
|
||||
if innerCfg.vim.keymap._validate."${m}"."${lhs}" == rhs then vars.genConfig
|
||||
else abort "This case should never happen."
|
||||
))
|
||||
]);
|
||||
|
|
|
@ -4,8 +4,8 @@ let cfg = config.vim.keymap; in
|
|||
{
|
||||
options.vim.keymap = with lib; {
|
||||
_validate = mkOption {
|
||||
# buffer mode lhs rhs
|
||||
type = with types; attrsOf (attrsOf (attrsOf (either str attrs)));
|
||||
# mode lhs rhs
|
||||
type = with types; attrsOf (attrsOf (either str attrs));
|
||||
visible = false;
|
||||
internal = true;
|
||||
readOnly = true;
|
||||
|
@ -29,12 +29,10 @@ let cfg = config.vim.keymap; in
|
|||
else if m == "l" then [ m "i" "c" "l" ]
|
||||
else m
|
||||
)));
|
||||
|
||||
buf = lib.optionalString (buffer != null) buffer.raw;
|
||||
in
|
||||
lib.foldl lib.recursiveUpdate { }
|
||||
(lib.flip map unwrappedModes (m: {
|
||||
"${buf}"."${m}"."${lhs}" = rhs;
|
||||
"${m}"."${lhs}" = rhs;
|
||||
}))
|
||||
)
|
||||
cfg.set);
|
||||
|
|
Loading…
Reference in a new issue