Created
May 21, 2025 12:46
-
-
Save thomasfr/0642bf6ca2efe730f0208df025fecb44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export FZF_DEFAULT_OPTS=' | |
--color=fg:-1,fg+:-1,bg:-1,bg+:-1 | |
--color=hl:#b254ff,hl+:#d29cff,info:#afaf87,marker:#87ff00 | |
--color=prompt:#87ff00,spinner:#af5fff,pointer:#af5fff,header:#87afaf | |
--color=border:#262626,label:#aeaeae,query:#d9d9d9 | |
--preview-window="border-rounded" --prompt="➜ " --pointer="➜ " | |
--separator="" --scrollbar="│" --info="hidden" --border="rounded" | |
' | |
export FZF_DEFAULT_COMMAND='fd | |
--type f | |
--strip-cwd-prefix | |
--exclude ".git" | |
--exclude "node_modules" | |
--exclude "Music" | |
--exclude "Movies" | |
--exclude "Library" | |
' | |
export FZF_COMPLETION_OPTS='--border="rounded" --info=hidden' | |
# Preview file content using bat (https://github.com/sharkdp/bat) | |
export FZF_CTRL_T_OPTS=" | |
--height 100% --reverse --info=right | |
--walker-skip .git,node_modules,Music,Movies,Library,Pictures,Public | |
--preview 'bat --style numbers,changes --color=always {} | head -500'" | |
export FZF_CTRL_R_OPTS=" | |
--preview 'echo {}' --preview-window up:3:hidden:wrap | |
--bind 'ctrl-y:execute-silent(echo -n {2..} | pbcopy)+abort'" | |
export FZF_ALT_C_OPTS=" | |
--height 100% --reverse --info=right | |
--walker-skip .git,node_modules,Music,Movies,Library,Pictures,Public | |
--preview 'tree -C {}'" | |
# Use fd (https://github.com/sharkdp/fd) for listing path candidates. | |
# - The first argument to the function ($1) is the base path to start traversal | |
# - See the source code (completion.{bash,zsh}) for the details. | |
_fzf_compgen_path() { | |
fd -tf -td -tx --hidden --strip-cwd-prefix --max-results 1000 --exclude ".git" --exclude "node_modul | |
} | |
# Use fd to generate the list for directory completion | |
_fzf_compgen_dir() { | |
fd -td --hidden --strip-cwd-prefix --max-results 1000 --exclude ".git" --exclude "node_modules" --ex | |
} | |
# Advanced customization of fzf options via _fzf_comprun function | |
# - The first argument to the function is the name of the command. | |
# - You should make sure to pass the rest of the arguments to fzf. | |
_fzf_comprun() { | |
local command=$1 | |
shift | |
case "$command" in | |
cd) fzf --preview 'tree -C {} | head -200' "$@" ;; | |
export|unset) fzf --preview "eval 'echo \$'{}" "$@" ;; | |
ssh) fzf --preview 'dig {}' "$@" ;; | |
*) fzf --preview 'bat --style numbers,changes --color=always {} | head -500' "$@" ;; | |
esac | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment