aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2024-05-24 11:06:31 +0200
committerKarel Kočí <cynerd@email.cz>2024-05-24 11:36:47 +0200
commit31f5accaa54f6110cfeefa19e3e4ed6d1a71190b (patch)
treea0664d1890b1796b9325700c2f3324cf3cf3c2a7
parentd1581b0cd33341fd9a9184d43b1479ded6b8f03b (diff)
downloadshellrc-31f5accaa54f6110cfeefa19e3e4ed6d1a71190b.tar.gz
shellrc-31f5accaa54f6110cfeefa19e3e4ed6d1a71190b.tar.bz2
shellrc-31f5accaa54f6110cfeefa19e3e4ed6d1a71190b.zip
less: fix hilite by using env
-rw-r--r--shellrc.d/less25
1 files changed, 17 insertions, 8 deletions
diff --git a/shellrc.d/less b/shellrc.d/less
index d2490a5..b9d4c90 100644
--- a/shellrc.d/less
+++ b/shellrc.d/less
@@ -1,10 +1,19 @@
# vim: ft=sh:
export LESS=-R
-export LESS_TERMCAP_mb=$'\E[1;31m'
-export LESS_TERMCAP_md=$'\E[1;36m'
-export LESS_TERMCAP_me=$'\E[0m'
-export LESS_TERMCAP_se=$'\E[0m'
-export LESS_TERMCAP_so=$'\E[01;44;33m'
-export LESS_TERMCAP_ue=$'\E[0m'
-export LESS_TERMCAP_us=$'\E[1;32m'
-[ -x /usr/bin/src-hilite-lesspipe.sh ] && export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
+export LESS_TERMCAP_mb=$(tput bold; tput setaf 2)
+export LESS_TERMCAP_md=$(tput bold; tput setaf 6)
+export LESS_TERMCAP_me=$(tput sgr0)
+export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4)
+export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
+export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 7)
+export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
+export LESS_TERMCAP_mr=$(tput rev)
+export LESS_TERMCAP_mh=$(tput dim)
+export LESS_TERMCAP_ZN=$(tput ssubm)
+export LESS_TERMCAP_ZV=$(tput rsubm)
+export LESS_TERMCAP_ZO=$(tput ssupm)
+export LESS_TERMCAP_ZW=$(tput rsupm)
+export GROFF_NO_SGR=1 # For Konsole and Gnome-terminal
+if command -v src-hilite-lesspipe.sh >/dev/null; then
+ export LESSOPEN="| $(command -v src-hilite-lesspipe.sh) %s"
+fi