Fix manpage colors with bat

This commit is contained in:
ItsDrike 2021-07-17 22:58:26 +02:00
parent ad62b8570d
commit 9414530758
No known key found for this signature in database
GPG key ID: B5F6B41F708C3ADD

View file

@ -17,7 +17,7 @@ export XDG_RUNTIME_DIR="/run/user/$UID"
# Pre-Application XDG settings # Pre-Application XDG settings
export ZDOTDIR="$XDG_CONFIG_HOME/zsh" export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc" export XINITRC="$XDG_CONFIG_HOME/x11/xinitrc"
export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs. #export XAUTHORITY="$XDG_RUNTIME_DIR/Xauthority" # This line will break some DMs.
export LESSHISTFILE="-" export LESSHISTFILE="-"
export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc" export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc" export WGETRC="$XDG_CONFIG_HOME/wget/wgetrc"
@ -40,15 +40,18 @@ export IPYTHONDIR="$XDG_CONFIG_HOME/ipython"
#export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages #export NUGET_PACKAGES="$XDG_CACHE_HOME"/NuGetPackages
# Colorful man pages # Colorful man pages
export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')" # If bat is installed, use it as manpager
export LESS_TERMCAP_md="$(printf '%b' '[1;36m')" if command -v bat > /dev/null; then
export LESS_TERMCAP_me="$(printf '%b' '[0m')" export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')" else
export LESS_TERMCAP_se="$(printf '%b' '[0m')" export LESS_TERMCAP_mb="$(printf '%b' '[1;31m')"
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')" export LESS_TERMCAP_md="$(printf '%b' '[1;36m')"
export LESS_TERMCAP_ue="$(printf '%b' '[0m')" export LESS_TERMCAP_me="$(printf '%b' '[0m')"
# If we have bat installed, use it as manpager export LESS_TERMCAP_so="$(printf '%b' '[01;44;33m')"
command -v bat > /dev/null && export MANPAGER="sh -c 'col -bx | bat -l man -p'" # Format manuals with bat (colors) export LESS_TERMCAP_se="$(printf '%b' '[0m')"
export LESS_TERMCAP_us="$(printf '%b' '[1;32m')"
export LESS_TERMCAP_ue="$(printf '%b' '[0m')"
fi
# Other program settings # Other program settings
export SUDO_ASKPASS="$HOME/.local/bin/dmenu/dmenupass" export SUDO_ASKPASS="$HOME/.local/bin/dmenu/dmenupass"
@ -56,7 +59,9 @@ export PIPENV_VENV_IN_PROJECT=1 # Force pipenv to create new environments within
#export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme. #export QT_QPA_PLATFORMTHEME="gtk2" # Have QT use gtk2 theme.
# Start graphical session, if startx is aviable # Start graphical session, if startx is aviable
if [ "$(tty)" = "/dev/tty1" ] && [ -x "$(command -v startx)"]; then if [ "$(tty)" = "/dev/tty1" ]; then
if command -v startx > /dev/null; then
! pidof -s Xorg > /dev/null 2>&1 && exec startx "$XINITRC" ! pidof -s Xorg > /dev/null 2>&1 && exec startx "$XINITRC"
fi
fi fi