Skip to content

Commit

Permalink
Merge pull request #102 from unixorn/update-pager-setting
Browse files Browse the repository at this point in the history
Don't assume `bat` is installed
  • Loading branch information
unixorn authored Mar 6, 2024
2 parents fb8340c + df8d8f2 commit a1f1fb7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion fzf-zsh-plugin.plugin.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,16 @@ fi
# - An advanced preview using a `less` preprocessor, capable of showing a wide range of formats, incl. images, dirs,
# CSVs, and other binary files (depending on available tooling).
_fzf_preview() {
foolproofPreview='([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2>/dev/null | head -n 200'
_fzf_preview_pager='cat'
foolproofPreview='cat {}'
if _fzf_has bat; then
_fzf_preview_pager='bat'
foolproofPreview='([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2>/dev/null | head -n 200'
fi
if _fzf_has batcat; then
_fzf_preview_pager='batcat'
foolproofPreview='([[ -f {} ]] && (batcat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2>/dev/null | head -n 200'
fi
local preview
[[ "$FZF_PREVIEW_ADVANCED" == true ]] \
&& preview="lessfilter-fzf {}" \
Expand Down

0 comments on commit a1f1fb7

Please sign in to comment.