From ca7868dc2977e2bdb4b1c909768c686d4ec0a412 Mon Sep 17 00:00:00 2001 From: Hans Date: Sun, 2 May 2021 00:10:41 +0200 Subject: [PATCH] fzf: option for tmux usage in shell integration (#1926) Added options for setting: FZF_TMUX FZF_TMUX_OPTS environment variables, which changes behaviour of fzf shell integration. --- modules/programs/fzf.nix | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/programs/fzf.nix b/modules/programs/fzf.nix index f945c7d4d..9f1c6522d 100644 --- a/modules/programs/fzf.nix +++ b/modules/programs/fzf.nix @@ -88,6 +88,23 @@ in { ''; }; + tmux = { + enableShellIntegration = mkEnableOption '' + setting FZF_TMUX=1 which causes shell integration to use fzf-tmux + ''; + + shellIntegrationOptions = mkOption { + type = types.listOf types.str; + default = [ ]; + example = literalExample ''[ "-d 40%" ]''; + description = '' + If is set to true, + shell integration will use these options for fzf-tmux. + See fzf-tmux --help for available options. + ''; + }; + }; + enableBashIntegration = mkOption { default = true; type = types.bool; @@ -125,6 +142,8 @@ in { FZF_CTRL_T_OPTS = cfg.fileWidgetOptions; FZF_DEFAULT_COMMAND = cfg.defaultCommand; FZF_DEFAULT_OPTS = cfg.defaultOptions; + FZF_TMUX = if cfg.tmux.enableShellIntegration then "1" else null; + FZF_TMUX_OPTS = cfg.tmux.shellIntegrationOptions; }); programs.bash.initExtra = mkIf cfg.enableBashIntegration ''