functions.zsh: set exa+bat preview for fzf-open

This commit is contained in:
leo 2023-02-21 15:26:17 +01:00
parent f95e448736
commit d4eb047518
Signed by: wanderer
SSH Key Fingerprint: SHA256:Dp8+iwKHSlrMEHzE3bJnPng70I7LEsa3IJXRH/U+idQ

@ -48,9 +48,14 @@ delete-branches() {
fzf-open() {
local output
local old_opts="$FZF_DEFAULT_OPTS"
FZF_DEFAULT_OPTS+=" --preview 'exa -al --group --group-directories-first --colour-scale --list-dirs --icons --git --time-style=full-iso {}' --bind '?:preview:bat --style=numbers --color=always --line-range :200 {}'"
output=$(fzf </dev/tty)
vim --not-a-term ${output}
if [ ! -z "$output" ]; then
vim --not-a-term ${output}
fi
zle reset-prompt
export FZF_DEFAULT_OPTS="$old_opts"
}
zle -N fzf-open