Updated less to run nvim less, vim less, or actual less

This commit is contained in:
Eric Renfro 2019-01-05 22:52:16 -05:00
parent 36de785a2a
commit a77d87960d
Signed by: psi-jack
GPG Key ID: 14977F3A50D9A5BF
1 changed files with 40 additions and 1 deletions

View File

@ -16,7 +16,46 @@ export LESS_TERMCAP_ue=$'\e[0m' # end underline
#export LESS_TERMCAP_mr=$(tput rev)
#export LESS_TERMCAP_mh=$(tput dim)
export LESS="-R"
export LESS="-R -x2 -I"
export LESSOPEN="|~/bin/lessfilter %s"
export PYGMENTIZE_STYLE='lovelace'
#if [[ -f "/usr/share/nvim/runtime/macros/less.sh" ]]; then
# alias less="/usr/share/nvim/runtime/macros/less.sh"
#elif [[ -f "/usr/share/vim/vim80/macros/less.sh" ]]; then
# alias less="/usr/share/vim/vim80/macros/less.sh"
#elif [[ -f "/usr/share/vim/vim74/macros/less.sh" ]]; then
# alias less="/usr/share/vim/vim74/macros/less.sh"
#fi
function less() {
if [ -t 1 ]; then
if test $# = 0; then
if test -t 0; then
echo "Missing filename" 1>&2
exit
fi
/usr/bin/less -
else
if [[ -f "/usr/share/nvim/runtime/macros/less.sh" ]]; then
/usr/share/nvim/runtime/macros/less.sh "$@"
elif [[ -f "/usr/share/vim/vim80/macros/less.sh" ]]; then
/usr/share/vim/vim80/macros/less.sh "$@"
elif [[ -f "/usr/share/vim/vim74/macros/less.sh" ]]; then
/usr/share/vim/vim74/macros/less.sh "$@"
else
/usr/bin/less "$@"
fi
fi
else
if test $# = 0; then
if test -t 0; then
echo "Missing filename" 1>&2
exit
fi
cat
else
cat "$@"
fi
fi
}