diff --git a/modules/programs/fish.nix b/modules/programs/fish.nix index ad9e8d93..88164685 100644 --- a/modules/programs/fish.nix +++ b/modules/programs/fish.nix @@ -250,11 +250,13 @@ let description = "Specify the bind mode that the bind is used in"; type = with types; - nullOr (enum [ - "default" - "insert" - "paste" - ]); + nullOr ( + either (enum [ + "default" + "insert" + "paste" + ]) str + ); default = null; }; command = mkOption { @@ -279,11 +281,13 @@ let description = "Change current mode after bind is executed"; type = with types; - nullOr (enum [ - "default" - "insert" - "paste" - ]); + nullOr ( + either (enum [ + "default" + "insert" + "paste" + ]) str + ); default = null; }; erase = mkEnableOption "remove bind"; diff --git a/tests/modules/programs/fish/binds.nix b/tests/modules/programs/fish/binds.nix index 65e8a264..d41766ba 100644 --- a/tests/modules/programs/fish/binds.nix +++ b/tests/modules/programs/fish/binds.nix @@ -14,6 +14,12 @@ command = "exit"; }; + # Allow arbitrary modes + "f" = { + mode = "something-non-default"; + command = "exit"; + }; + "ctrl-c" = { mode = "insert"; command = [ @@ -57,6 +63,8 @@ "bind --preset alt-s 'fish_commandline_prepend sudo" assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ "bind --mode visual ctrl-d exit" + assertFileContains home-files/.config/fish/functions/fish_user_key_bindings.fish \ + "bind --mode something-non-default f exit" ''; }; };