2024-11-16 15:10:06 -08:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
2024-11-16 23:29:38 -08:00
|
|
|
inherit (lib) mkEnableOption mkIf;
|
|
|
|
inherit (lib.marleyos) enabled;
|
2024-11-16 15:10:06 -08:00
|
|
|
|
2024-11-16 22:34:40 -08:00
|
|
|
cfg = config.marleyos.programs.fzf;
|
|
|
|
inherit (config.marleyos.theme) colors;
|
2024-11-16 15:10:06 -08:00
|
|
|
|
|
|
|
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;
|
|
|
|
has-difft = config.programs.git.difftastic.enable;
|
|
|
|
in
|
|
|
|
{
|
2024-11-16 23:29:38 -08:00
|
|
|
options.marleyos.programs.fzf.enable = mkEnableOption "fzf";
|
2024-11-16 15:10:06 -08:00
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
programs.fzf = {
|
|
|
|
enable = true;
|
|
|
|
|
2024-11-16 22:44:45 -08:00
|
|
|
rose-pine = mkIf colors.isRosePine enabled;
|
2024-11-16 15:10:06 -08:00
|
|
|
|
|
|
|
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 =
|
|
|
|
if has-delta then
|
|
|
|
{
|
|
|
|
fzf_diff_highlighter = "delta --paging=never --features=arctic-fox";
|
|
|
|
}
|
|
|
|
else if has-difft then
|
|
|
|
{
|
|
|
|
fzf_diff_highlighter = "difft --color=always";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ };
|
|
|
|
};
|
|
|
|
}
|