Files
m3ta-home/profiles/base/cli-tools/fzf.nix
T

49 lines
1.8 KiB
Nix
Raw Normal View History

2026-05-02 09:08:40 +02:00
# Fuzzy finder with nix-colors palette and Wayland clipboard integration.
{
config,
lib,
2026-07-07 19:39:43 +02:00
options,
2026-05-02 09:08:40 +02:00
...
}:
with lib; let
cfg = config.base.cliTools.fzf;
2026-07-07 19:39:43 +02:00
changeDirWidgetCommand = "fd --type d --exclude .git --follow --hidden";
2026-05-02 09:08:40 +02:00
in {
# Enabled by default — base modules are always-on.
options.base.cliTools.fzf.enable = (mkEnableOption "enable fuzzy finder") // {default = true;};
config = mkIf cfg.enable {
2026-07-07 19:39:43 +02:00
programs.fzf =
{
enable = true;
enableFishIntegration = true;
colors = {
"fg" = "#${config.colorScheme.palette.base05}";
"bg" = "#${config.colorScheme.palette.base00}";
"hl" = "#${config.colorScheme.palette.base0E}";
"fg+" = "#${config.colorScheme.palette.base05}";
"bg+" = "#${config.colorScheme.palette.base02}";
"hl+" = "#${config.colorScheme.palette.base0E}";
"info" = "#${config.colorScheme.palette.base09}";
"prompt" = "#${config.colorScheme.palette.base0B}";
"pointer" = "#${config.colorScheme.palette.base08}";
"marker" = "#${config.colorScheme.palette.base08}";
"spinner" = "#${config.colorScheme.palette.base09}";
"header" = "#${config.colorScheme.palette.base03}";
};
defaultOptions = [
"--preview='bat --color=always -n {}'"
"--bind 'ctrl-/:toggle-preview'"
"--header 'Press CTRL-Y to copy command into clipboard'"
"--bind 'ctrl-y:execute-silent(echo -n {2..} | wl-copy)+abort'"
];
defaultCommand = "fd --type f --exclude .git --follow --hidden";
}
// (
if options.programs.fzf ? changeDirWidget
then {changeDirWidget.command = changeDirWidgetCommand;}
else {inherit changeDirWidgetCommand;}
);
2026-05-02 09:08:40 +02:00
};
}