diff --git a/.zshrc b/.zshrc index 25c3faf..35b39df 100644 --- a/.zshrc +++ b/.zshrc @@ -147,7 +147,9 @@ _fzf_compgen_dir() { source ~/fzf-git.sh/fzf-git.sh -export FZF_CTRL_T_OPTS="--preview 'bat -n --color=always --line-range :500 {}'" +show_file_or_dir_preview="if [ -d {} ]; then eza --tree --color=always {} | head -200; else bat -n --color=always --line-range :500 {}; fi" + +export FZF_CTRL_T_OPTS="--preview '$show_file_or_dir_preview'" export FZF_ALT_C_OPTS="--preview 'eza --tree --color=always {} | head -200'" # Advanced customization of fzf options via _fzf_comprun function @@ -159,9 +161,9 @@ _fzf_comprun() { case "$command" in cd) fzf --preview 'eza --tree --color=always {} | head -200' "$@" ;; - export|unset) fzf --preview "eval 'echo \$'{}" "$@" ;; + export|unset) fzf --preview "eval 'echo \${}'" "$@" ;; ssh) fzf --preview 'dig {}' "$@" ;; - *) fzf --preview "bat -n --color=always --line-range :500 {}" "$@" ;; + *) fzf --preview "$show_file_or_dir_preview" "$@" ;; esac }