Try lesspipe in addition to lesspipe.sh for LESSOPEN

Debian based systems have `lesspipe`, without '.sh' suffix.
Since `$commands` is an associative array, we do index search and set
the input preprocessor on first match.
This commit is contained in:
Indrajit Raychaudhuri 2014-05-03 15:56:36 -05:00 committed by Sorin Ionescu
parent 86ba5b69d3
commit 53bd555c6d

View file

@ -57,8 +57,9 @@ path=(
export LESS='-F -g -i -M -R -S -w -X -z-4' export LESS='-F -g -i -M -R -S -w -X -z-4'
# Set the Less input preprocessor. # Set the Less input preprocessor.
if (( $+commands[lesspipe.sh] )); then # Try both `lesspipe` and `lesspipe.sh` as either might exist on a system.
export LESSOPEN='| /usr/bin/env lesspipe.sh %s 2>&-' if (( $#commands[(i)lesspipe(|.sh)] )); then
export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi fi
# #