dotfiles/modules/common/shell/fzf.nix
Noah Masur 95e8d5c268 switch to proximity fzf project switcher
also sadly must remove the shortcut names because sorting requires full paths
2024-01-14 22:33:29 -05:00

42 lines
1004 B
Nix

{ config, pkgs, ... }: {
# FZF is a fuzzy-finder for the terminal
home-manager.users.${config.user} = {
programs.fzf.enable = true;
programs.fish = {
functions = {
projects = {
description = "Jump to a project";
body = ''
set projdir ( \
fd \
--search-path $HOME/dev \
--type directory \
--exact-depth 2 \
| ${pkgs.proximity-sort}/bin/proximity-sort . \
| sed 's/\\/$//' \
| fzf --tiebreak=index \
)
and cd $projdir
and commandline -f execute
'';
};
};
shellAbbrs = { lsf = "ls -lh | fzf"; };
};
# Global fzf configuration
home.sessionVariables = let fzfCommand = "fd --type file";
in {
FZF_DEFAULT_COMMAND = fzfCommand;
FZF_CTRL_T_COMMAND = fzfCommand;
FZF_DEFAULT_OPTS = "-m --height 50% --border";
};
};
}