From 883810a8b2374d2b9012444c576f8fb352a1cfb3 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Mon, 26 Jan 2026 20:16:11 +0100 Subject: [PATCH] extend cdf and pwdf ignore patterns --- modules/zsh.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/modules/zsh.nix b/modules/zsh.nix index ef7bb36..1f86711 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -1,5 +1,12 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: +let + fdIgnorePatterns = [ + "Documents/app-state" + "Library" + ]; + fdExcludes = lib.concatMapStrings (p: "-E ${lib.escapeShellArg p} ") fdIgnorePatterns; +in { programs.zsh = { enable = true; @@ -93,7 +100,7 @@ function cdf() { local search_dir="''${1:-~}" local target - target=$(echo "" | fzf --bind "change:reload:fd --follow -E Documents/app-state {q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to cd" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi) + target=$(echo "" | fzf --bind "change:reload:fd --follow ${fdExcludes}{q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to cd" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi) if [[ -n "$target" ]]; then [[ -d "$target" ]] && cd "$target" || cd "$(dirname "$target")" fi @@ -103,7 +110,7 @@ function pwdf() { local search_dir="''${1:-~}" local target - target=$(echo "" | fzf --bind "change:reload:fd --follow -E Documents/app-state {q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to print path" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi) + target=$(echo "" | fzf --bind "change:reload:fd --follow ${fdExcludes}{q} ''$search_dir 2>/dev/null || true" --header="Type to search, Enter to print path" --preview '([[ -d {} ]] && ls -la {}) || ([[ -f {} ]] && head -20 {})' --height 40% --ansi) if [[ -n "$target" ]]; then echo "$target" fi