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.
This commit is contained in:
parent
b2b712c67b
commit
4dd83006bc
2 changed files with 9 additions and 35 deletions
35
bin/,man
35
bin/,man
|
@ -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 "$@"
|
||||
|
|
@ -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; }
|
||||
|
|
Loading…
Add table
Reference in a new issue