Home-Manager fzf doesn't set ctrl + t binding

I have setup fzf through home-manager along with zsh and have found that the FZF_CTRL_T_COMMAND is not being set even though I’m setting the fzf.fileWidgetCommand

printenv | grep FZF

FZF_DEFAULT_COMMAND=fd --hidden
FZF_CTRL_T_COMMAND=
FZF_ALT_C_COMMAND=fd --type=d --hidden
FZF_DEFAULT_OPTS=--color bg:#011628,bg+:#143652,fg:#CBE0F0,fg+:#CBE0F0,header:#2CF9ED,hl:#B388FF,hl+:#B388FF,info:#06BCE4,marker:#2CF9ED,pointer:#2CF9ED,prompt:#2CF9ED,spinner:#2CF9ED

Here is my .nix file

{ config, pkgs, nixpkgs, inputs, ... }:

{
  home.shellAliases = {
    vim = "nvim";
  };

  programs.zsh = {
    enable = true;

    #initExtra = ''
    #'';
  };

  programs.starship = {
    enable = true;

    enableZshIntegration = true;
  };

  programs.kitty = {
    enable = true;

    shellIntegration = {
      enableZshIntegration = true;
    };

    theme = "Tokyo Night";

    settings = {
      enable_audio_bell = false;
    };
  };

  programs.fd = {
    enable = true;
  };

  programs.fzf = {
    enable = true;

    enableZshIntegration = true;

    defaultCommand = "fd --hidden";
    # NOTE: This doesn't seem to work
    fileWidgetCommand = "fd --hidden";
    changeDirWidgetCommand = "fd --type=d --hidden";

    colors = {
      fg = "#${config.colorScheme.palette.base08}";
      "fg+" = "#${config.colorScheme.palette.base08}";
      bg = "#${config.colorScheme.palette.base01}";
      "bg+" = "#${config.colorScheme.palette.base01}";
      hl = "#${config.colorScheme.palette.base0E}";
      "hl+" = "#${config.colorScheme.palette.base0E}";
      info = "#${config.colorScheme.palette.base0A}";
      prompt = "#${config.colorScheme.palette.base0D}";
      pointer = "#${config.colorScheme.palette.base08}";
      marker = "#${config.colorScheme.palette.base08}";
      spinner = "#${config.colorScheme.palette.base08}";
      header = "#${config.colorScheme.palette.base08}";
    };
  };
}
1 Like

Does this persist even after a reboot?

Oops yep it worked after a reboot. Curious why this is required when an os switch and a new terminal should pick these things up?

2 Likes

Looking at ~/.zshenv, it seems that home-manager env vars are set to only be sourced once, which usually happens at login:

# Environment variables
. "/etc/profiles/per-user/<user>/etc/profile.d/hm-session-vars.sh"

If we examine this file, we will find:

# Only source this once.
if [ -n "$__HM_SESS_VARS_SOURCED" ]; then return; fi
export __HM_SESS_VARS_SOURCED=1

As such, if we’d like for these variables to be sourced again we need to either re-login or reboot.