From 7d3c439ba4e7afa0537baf3f41bf7a38b326e0b1 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 22 Sep 2014 10:12:50 +0200 Subject: [PATCH] zshenv: switch preference order of lesspipe.sh vs lesspipe The lesspipe script as shipped by the less package itself seems to be better maintained nowadays than the lesspipe.sh script as shipped with the grml-script-core package. While lesspipe.sh supports the "less $archive:$file" workflow to display a file inside an archive, which isn't supported by lesspipe yet, it sadly fails on more common tasks like with our dchange function on recent Debian versions. E.g. 'dchange vim' just displays: | ==> append : to filename to view the UTF-8 encoded data on Debian/jessie instead of displaying content of /usr/share/doc/vim/changelog.Debian.gz. While at it make the check for lesspipe path agnostic, thanks Frank Terbeck for assistance. --- etc/zsh/zshenv | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/etc/zsh/zshenv b/etc/zsh/zshenv index 57e45f2..bf6c819 100644 --- a/etc/zsh/zshenv +++ b/etc/zsh/zshenv @@ -79,11 +79,14 @@ esac # less (:=pager) options: # export LESS=C -if [[ -x /usr/bin/lesspipe.sh ]] ; then - export LESSOPEN="|lesspipe.sh %s" -elif [[ -x /usr/bin/lesspipe ]] ; then +typeset -a lp; lp=( ${^path}/lesspipe(N) ) +if (( $#lp > 0 )) && [[ -x $lp[1] ]] ; then export LESSOPEN="|lesspipe %s" +elif [[ -x /usr/bin/lesspipe.sh ]] ; then + export LESSOPEN="|lesspipe.sh %s" fi +unset lp + export READNULLCMD=${PAGER:-/usr/bin/pager} # allow zeroconf for distcc -- 2.1.4