From: Iain Patterson Date: Tue, 27 Jul 2010 14:40:02 +0000 (+0100) Subject: Settings for less. X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=c66932991642182e402d7f5bd7ee71038e5c93af;p=profile.git Settings for less. Set colours and character set if GNU less is found. --- diff --git a/.profile.d/pager.bashrc b/.profile.d/pager.bashrc new file mode 100644 index 0000000..a138375 --- /dev/null +++ b/.profile.d/pager.bashrc @@ -0,0 +1,42 @@ +# profile-required: TERM.bashrc +less=$(find_working less 2>/dev/null) +if [ $? = 0 ]; then + export PAGER=less + export GIT_PAGER=$PAGER + export LESSCHARSET=utf-8 + + # Colours. + case $(tput colors) in + 256) + # Blink is green. + export LESS_TERMCAP_mb=$'\e[38;5;34m' + # Bold is blue. + export LESS_TERMCAP_md=$'\e[1m\e[38;5;33m' + # Standout is yellow. + export LESS_TERMCAP_so=$'\e[1m\e[38;5;226m' + # Underline is cyan. + export LESS_TERMCAP_us=$'\e[0m\e[38;5;38m' + ;; + + 88) + export LESS_TERMCAP_mb=$'\e[38;5;24m' + export LESS_TERMCAP_md=$'\e[1m\e[38;5;23m' + export LESS_TERMCAP_so=$'\e[1m\e[38;5;76m' + export LESS_TERMCAP_us=$'\e[0m\e[38;5;26m' + ;; + + *) + export LESS_TERMCAP_mb=$'\e[32m' + export LESS_TERMCAP_md=$'\e[1m\e[36m' + export LESS_TERMCAP_so=$'\e[1m\e[33m' + export LESS_TERMCAP_us=$'\e[36m' + ;; + esac + + export LESS_TERMCAP_me=$'\e[0m' + export LESS_TERMCAP_se=$'\e[0m' + export LESS_TERMCAP_ue=$'\e[0m' +else + alias less=more +fi +unset less