mirror of
https://github.com/josean-dev/dev-environment-files.git
synced 2025-01-06 16:31:16 +01:00
Fixed files/directories fzf preview to use eza for directories and bat for files
This commit is contained in:
parent
8600b31188
commit
d48a879e2e
1 changed files with 5 additions and 3 deletions
8
.zshrc
8
.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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue