From 5e12b830c84ec62cea9f3c2b8e731a140a8ea686 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Mon, 29 Apr 2024 16:33:51 +0300 Subject: [PATCH] modules/keymap: dedup mode list before folding --- modules/vim/keymap.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/vim/keymap.nix b/modules/vim/keymap.nix index 8f29e89..01cc8eb 100644 --- a/modules/vim/keymap.nix +++ b/modules/vim/keymap.nix @@ -22,15 +22,15 @@ let cfg = config.vim.keymap; in ({ mode, lhs, rhs, buffer, ... }: let 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" ] else if m == "!" then [ m "i" "c" ] else if m == "v" then [ m "x" "s" ] else if m == "l" then [ m "i" "c" "l" ] else m - )); + ))); - buf = if buffer == null then "" else buffer; + buf = lib.optionalString (buffer != null) buffer; in lib.foldl lib.recursiveUpdate { } (lib.flip map unwrappedModes (m: {