From 4dd83006bc26dfeb606bd9f4f454afebf55c5ad3 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Sun, 8 Aug 2021 23:46:15 +0200 Subject: [PATCH] bin: remove need to man wrapper Instead of wrapping man (1), I just export the LESS_TERMCAP_* variables into the environment. This achieves the same thing as the wrapper script, with the added benefit that less (1) will use the configured colors in any of its invocations, not only via the wrapper script. --- bin/,man | 35 ----------------------------------- files/profile.sh | 9 +++++++++ 2 files changed, 9 insertions(+), 35 deletions(-) delete mode 100755 bin/,man diff --git a/bin/,man b/bin/,man deleted file mode 100755 index 5a8d870..0000000 --- a/bin/,man +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Colorized man pages - -Reset=$(tput sgr0) -Base03=8 -Base02=0 -Base01=10 -Base00=11 -Base0=12 -Base1=14 -Base2=7 -Base3=15 -Red=1 -Orange=9 -Yellow=3 -Green=2 -Cyan=6 -Blue=4 -Violet=13 -Magenta=5 - -standout=$( printf '%s\n' "setaf $Base03" "setab $Cyan" | tput -S) -bold=$( printf '%s\n' "setaf $Yellow" | tput -S) -underline=$(printf '%s\n' "setaf $Base3" "smul" | tput -S) - -exec env \ - LESS_TERMCAP_so="$standout" \ - LESS_TERMCAP_md="$bold" \ - LESS_TERMCAP_us="$underline" \ - LESS_TERMCAP_se="$Reset" \ - LESS_TERMCAP_me="$Reset" \ - LESS_TERMCAP_ue="$Reset" \ - GROFF_NO_SGR=1 \ - man "$@" - diff --git a/files/profile.sh b/files/profile.sh index 42b7487..2277e87 100644 --- a/files/profile.sh +++ b/files/profile.sh @@ -63,6 +63,15 @@ export PAGER=less export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" export ZDOTDIR="$XDG_CONFIG_HOME/zsh" +# Make man pages pretty +export LESS_TERMCAP_so="$(printf '%s\n' "setaf $Base03" "setab $Cyan" | tput -S)" +export LESS_TERMCAP_md="$(printf '%s\n' "setaf $Yellow" | tput -S)" +export LESS_TERMCAP_us="$(printf '%s\n' "setaf $Base3" 'smul' | tput -S)" +export LESS_TERMCAP_se="$Reset" +export LESS_TERMCAP_me="$Reset" +export LESS_TERMCAP_ue="$Reset" +export GROFF_NO_SGR=1 + # Prevent path_helper from messing with the PATH when starting tmux. # See: https://superuser.com/a/583502 [ "$(uname -s)" = "Darwin" ] && { PATH=""; source /etc/profile; }