Skip to content

fd

Resources

Powering FZF

fd can power fzf by setting through the environment variable $FZF_DEFAULT_COMMAND.

My $FZF_DEFAULT_COMMAND is:

fd -ipH -t f dir
# -i:   for ignoring case
# -H:   for including hidden files
# -p:   is search on the entire path, and not just the file name
# -t f: is to only search files (and not directories; gets annoying in Vim)
# dir:  where to search

Examples

fd -t d -I assets dir
# -t d:   is to only search directories
# - I:    ignore .fdignore file
# assets: the search term
fd -e md
# -e: search by extension
fd -t f
# -e: search files only

Ignore Files

fd has a -E flag for excluding files. For project specific configuration, create a .fdignore file, and place the exclude patterns in it. For global configuration, create a file at ~/.config/fd/ignore.

Easy copy from icloud to wiki folder

export WIKI_DIR="$HOME/Projects/knowledge"
export ICLOUD_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs"

alias ic2wiki='cp "$ICLOUD_DIR/export/$(ls $ICLOUD_DIR/export |fzf)" $(fd -t d -I assets '$WIKI_DIR' | fzf)'

# will copy from icloud/export to chosen wiki assets directory

Override .gitignore

Inspiration

# .gitignore
pyrightconfig.json
/some_directory/*

# .fdignore
!pyrightconfig.json
!/some_directory/*

Exact Match

fd has a --glob flag that does a glob-based search.