From 4b54a38bb56ec8128e37c68271226737e683046b Mon Sep 17 00:00:00 2001 From: "Manu [tennox]" Date: Tue, 23 Apr 2024 20:42:11 +0100 Subject: [PATCH] zellij: option to enable completions without enabling autostart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bit complicated to do this without breaking changes to the existing `enableFishIntegration`... 🤔 --- modules/programs/zellij.nix | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/programs/zellij.nix b/modules/programs/zellij.nix index 838684ea..079d20c0 100644 --- a/modules/programs/zellij.nix +++ b/modules/programs/zellij.nix @@ -49,7 +49,13 @@ in { default = false; }; - enableFishIntegration = mkEnableOption "Fish integration" // { + enableFishIntegration = mkEnableOption "Fish integration (enables both enableFishAutostart and enableFishCompletions)" // { + default = false; + }; + enableFishAutostart = mkEnableOption "autostart zellij in interactive sessions" // { + default = false; + }; + enableFishCompletions = mkEnableOption "load zellij completions" // { default = false; }; }; @@ -77,10 +83,15 @@ in { eval "$(${zellijCmd} setup --generate-auto-start zsh)" ''); - programs.fish.interactiveShellInit = mkIf cfg.enableFishIntegration - (mkOrder 200 '' - eval (${zellijCmd} setup --generate-auto-start fish | string collect) - eval (${zellijCmd} setup --generate-completion fish | string collect) - ''); + programs.fish.interactiveShellInit = mkIf (cfg.enableFishIntegration || cfg.enableFishAutostart || cfg.enableFishCompletions) + (mkOrder 200 ( + (if cfg.enableFishIntegration || cfg.enableFishCompletions then '' + eval (${zellijCmd} setup --generate-completion fish | string collect) + '' else "") + + (if cfg.enableFishIntegration || cfg.enableFishAutostart then '' + eval (${zellijCmd} setup --generate-auto-start fish | string collect) + '' else "") + )); + }; }