aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Wilken2022-10-23 16:55:30 +0200
committerTimo Wilken2022-10-23 16:55:30 +0200
commit2a23ec27d81062417775d1022860206b48b1412d (patch)
tree8807d6f21122e1e65d36d75719e5948a80262e7f
parentc493f3eb231e631d9258017ea6006e057cd3a0c5 (diff)
Fix colours in less
In order for `LESS_TERMCAP_*` variables to be processed properly when displaying man pages, we need `GROFF_NO_SGR=1`. Also, put `LESS_TERMCAP_*` variables into `lesskey` so they don't pollute the normal shell environment.
-rw-r--r--home-configuration.scm2
-rw-r--r--lesskey15
-rw-r--r--zshrc14
3 files changed, 17 insertions, 14 deletions
diff --git a/home-configuration.scm b/home-configuration.scm
index 107f117c..871b0adf 100644
--- a/home-configuration.scm
+++ b/home-configuration.scm
@@ -426,6 +426,8 @@ auto-expand-secmem
;; Guix force-overrides $LESS by default, so force-force it to do what I want instead.
;; `less' reads the `lesskey' file configured above.
("GUIX_PAGER" . "env -u LESS less")
+ ;; To make LESS_TERMCAP_* variables (set in lesskey) apply to man pages in kitty.
+ ("GROFF_NO_SGR" . "1")
;; Shell history -- primarily for zsh, but Emacs' eshell uses this too
("HISTSIZE" . "10000000")
diff --git a/lesskey b/lesskey
index cbc87bc4..6713654f 100644
--- a/lesskey
+++ b/lesskey
@@ -16,3 +16,18 @@ LESSHISTSIZE=10000
# *? setting is shared between LESS{,UTF}BINFMT, with the latter's setting taking priority
LESSBINFMT=*k%02X
LESSUTFBINFMT=U+%04lX
+# Use pretty colours for bold/underline/... -- mostly in `man'
+# https://wiki.archlinux.org/index.php/Color_output_in_console#less
+# Note: these values are verbatim as less doesn't support escaping
+# characters in lesskey (I think).
+# blink -> italic white-on-red
+LESS_TERMCAP_mb=
+# bold -> bold blue
+LESS_TERMCAP_md=
+LESS_TERMCAP_me=
+# reverse video -> reverse, bright yellow background
+LESS_TERMCAP_so=
+LESS_TERMCAP_se=
+# underline -> italic green
+LESS_TERMCAP_us=
+LESS_TERMCAP_ue=
diff --git a/zshrc b/zshrc
index 607fec77..abb8f066 100644
--- a/zshrc
+++ b/zshrc
@@ -138,20 +138,6 @@ ppscm () {
source-highlight -s scheme -f esc | less -RSM
}
-# Less: use pretty colours for bold/underline/... -- mostly in `man'
-# https://wiki.archlinux.org/index.php/Color_output_in_console#less
-# See terminfo(5) for tput code names.
-# blink -> italic white-on-red
-export LESS_TERMCAP_mb=$'\e'"[${color[standout]}m${fg[white]}${bg[red]}"
-# bold -> bold blue
-export LESS_TERMCAP_md="${fg_bold[blue]}"
-# reverse video -> reverse, bright yellow background
-export LESS_TERMCAP_so=$'\e'"[${color[reverse]}m${fg_bold[yellow]}"
-# underline -> italic green
-export LESS_TERMCAP_us=$'\e'"[${color[standout]}m${fg[green]}"
-# reset bold/blink, reverse video, underline
-export LESS_TERMCAP_me="$reset_color" LESS_TERMCAP_se="$reset_color" LESS_TERMCAP_ue="$reset_color"
-
## Plugins
_load_plugin () {
local _try_path