From 451beb4ecaf56fea38ffe82588364aae4161a2d8 Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Sat, 6 Jul 2024 00:34:58 +0200 Subject: [PATCH] plugins/leap: allow __empty for safeLabels option --- plugins/utils/leap.nix | 21 ++++++++++++--------- tests/test-sources/plugins/utils/leap.nix | 9 +++++++++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/plugins/utils/leap.nix b/plugins/utils/leap.nix index e7c9ac96..3ee06c9f 100644 --- a/plugins/utils/leap.nix +++ b/plugins/utils/leap.nix @@ -84,17 +84,20 @@ in }; }; - safeLabels = helpers.defaultNullOpts.mkListOf types.str (stringToCharacters "sfnut/SFNLHMUGT?Z") '' - When the number of matches does not exceed the number of these "safe" labels plus one, the - plugin jumps to the first match automatically after entering the pattern. - Obviously, for this purpose you should choose keys that are unlikely to be used right - after a jump! + safeLabels = + helpers.defaultNullOpts.mkNullable (with helpers.nixvimTypes; maybeRaw (listOf str)) + (stringToCharacters "sfnut/SFNLHMUGT?Z") + '' + When the number of matches does not exceed the number of these "safe" labels plus one, the + plugin jumps to the first match automatically after entering the pattern. + Obviously, for this purpose you should choose keys that are unlikely to be used right + after a jump! - Setting the list to `[]` effectively disables the autojump feature. + Setting the list to `[]` effectively disables the autojump feature. - Note: Operator-pending mode ignores this, since we need to be able to select the actual - target before executing the operation. - ''; + Note: Operator-pending mode ignores this, since we need to be able to select the actual + target before executing the operation. + ''; labels = helpers.defaultNullOpts.mkListOf types.str diff --git a/tests/test-sources/plugins/utils/leap.nix b/tests/test-sources/plugins/utils/leap.nix index 1a6d21b6..3e52fc22 100644 --- a/tests/test-sources/plugins/utils/leap.nix +++ b/tests/test-sources/plugins/utils/leap.nix @@ -3,6 +3,15 @@ plugins.leap.enable = true; }; + # https://github.com/nix-community/nixvim/issues/1698 + autojump-disabled = { + plugins.leap = { + enable = true; + + safeLabels.__empty = null; + }; + }; + example = { plugins.leap = { enable = true;