marleyos/home/programs/fzf.nix

44 lines
1.2 KiB
Nix

{ lib, config, ... }:
let
has-ripgrep = config.programs.ripgrep.enable;
has-fd = config.programs.fd.enable;
has-eza = config.programs.eza.enable;
has-bat = config.programs.bat.enable;
has-tmux = config.programs.tmux.enable;
has-delta = config.programs.git.delta.enable;
in
{
programs.fzf = {
enable = true;
rose-pine.enable = true;
defaultOptions = [
"--margin=10%,5%"
"--border=sharp"
"--pointer= "
"--marker= "
"--prompt= "
"--preview-label-pos='bottom'"
"--preview-window='border-sharp'"
];
defaultCommand = lib.mkIf has-ripgrep "rg --files --hidden --glob \"!.git\"";
changeDirWidgetCommand = lib.mkIf has-fd "fd --type d";
changeDirWidgetOptions = lib.mkIf has-eza [
"--preview 'eza --all --color=always --sort=name --group-directories-first --level=3 {}'"
];
fileWidgetCommand = lib.mkIf has-fd "fd --type f";
fileWidgetOptions = lib.mkIf has-bat [
"--preview 'bat {}'"
];
tmux.enableShellIntegration = lib.mkIf has-tmux true;
};
home.sessionVariables = lib.mkIf has-delta {
fzf_diff_highlighter = "delta --paging=never --features=arctic-fox";
};
}