modules/keymap: dedup mode list before folding
This commit is contained in:
parent
4c73e0220e
commit
5e12b830c8
1 changed files with 3 additions and 3 deletions
|
@ -22,15 +22,15 @@ let cfg = config.vim.keymap; in
|
||||||
({ mode, lhs, rhs, buffer, ... }:
|
({ mode, lhs, rhs, buffer, ... }:
|
||||||
let
|
let
|
||||||
sourceModes = if builtins.isList mode then mode else [ mode ];
|
sourceModes = if builtins.isList mode then mode else [ mode ];
|
||||||
unwrappedModes = lib.flatten (lib.flip map sourceModes (m:
|
unwrappedModes = lib.unique (lib.flatten (lib.flip map sourceModes (m:
|
||||||
if m == "" then [ m "n" "x" "s" "o" ]
|
if m == "" then [ m "n" "x" "s" "o" ]
|
||||||
else if m == "!" then [ m "i" "c" ]
|
else if m == "!" then [ m "i" "c" ]
|
||||||
else if m == "v" then [ m "x" "s" ]
|
else if m == "v" then [ m "x" "s" ]
|
||||||
else if m == "l" then [ m "i" "c" "l" ]
|
else if m == "l" then [ m "i" "c" "l" ]
|
||||||
else m
|
else m
|
||||||
));
|
)));
|
||||||
|
|
||||||
buf = if buffer == null then "" else buffer;
|
buf = lib.optionalString (buffer != null) buffer;
|
||||||
in
|
in
|
||||||
lib.foldl lib.recursiveUpdate { }
|
lib.foldl lib.recursiveUpdate { }
|
||||||
(lib.flip map unwrappedModes (m: {
|
(lib.flip map unwrappedModes (m: {
|
||||||
|
|
Loading…
Reference in a new issue