zsh/fzf.zsh

19 lines
719 B
Bash
Raw Normal View History

2023-07-10 12:31:40 +02:00
export FZF_COMPLETION_OPTS='--border --info=inline'
source /usr/share/doc/fzf/examples/completion.zsh
source /usr/share/doc/fzf/examples/key-bindings.zsh
# (EXPERIMENTAL) 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
vim|nvim|nano) fzf "$@" --preview 'batcat --color=always {}' ;;
cd) fzf "$@" --preview 'tree -C {} | head -200' ;;
export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;;
ssh) fzf "$@" --preview 'dig {}' ;;
*) fzf "$@" ;;
esac
}