[fzf#vim#with_preview] Incorporate batcat name (#1159)

* Added detection/selection of two bat install scenarios.
This commit is contained in:
DZ84
2020-11-03 17:59:18 +01:00
committed by GitHub
parent bd3a021ec1
commit 61c4b6d1ed

View File

@@ -39,8 +39,15 @@ if [ -z "$CENTER" ]; then
CENTER=0
fi
if [ -z "$FZF_PREVIEW_COMMAND" ] && command -v bat > /dev/null; then
bat --style="${BAT_STYLE:-numbers}" --color=always --pager=never \
# Sometimes bat is installed as batcat.
if command -v batcat > /dev/null; then
BATNAME="batcat"
elif command -v bat > /dev/null; then
BATNAME="bat"
fi
if [ -z "$FZF_PREVIEW_COMMAND" ] && [ "${BATNAME:+x}" ]; then
${BATNAME} --style="${BAT_STYLE:-numbers}" --color=always --pager=never \
--highlight-line=$CENTER "$FILE"
exit $?
fi