zshrc: support PAGER='less -Mr' usage and fall back to vi if LESSOPEN is unset
authorMichael Prokop <mika@grml.org>
Thu, 14 Nov 2019 15:31:21 +0000 (16:31 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 14 Nov 2019 16:30:59 +0000 (17:30 +0100)
commit675c85b5e23d4eb5ce94b7aaf300f6847cd0af81
tree2cef5f054d30dbd76c7902790aa75a688fd172d5
parent1be4f3ede299206ae9c5f7558263eef7b7314fcc
zshrc: support PAGER='less -Mr' usage and fall back to vi if LESSOPEN is unset

It's horribly annoying when PAGER is set to less, but lesspipe isn't configured
via LESSOPEN, then `dchange $package` fails with less like this:

% dchange zsh
"/usr/share/doc/zsh/changelog.Debian.gz" may be a binary file.  See it anyway?

vi(m) handles *.gz just fine, so let's try to use vi if PAGER is set to
less and LESSOPEN is unset.

While at it fix usage of ${PAGER} vs ${=PAGER} to also handle
a setting like PAGER='less -Mr' and PAGER=(less -Mr), otherwise
failing with `command not found: less -Mr`.

Thanks: AndrĂ¡s Korn for review and improvement suggestions
etc/zsh/zshrc