Updated less to run nvim less, vim less, or actual less
This commit is contained in:
parent
36de785a2a
commit
a77d87960d
1 changed files with 40 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue