zsh: cleanup bat configuration

master
bretello 2024-03-08 12:59:28 +01:00
parent b05fde87c2
commit 0c7d0ec24f
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
1 changed files with 8 additions and 7 deletions

View File

@ -84,23 +84,24 @@ export ZSH_AUTOSUGGEST_COMPLETION_IGNORE='* \#*' # prevent completion for commen
export LESS='-xRF-j12' # -j12: displays 12 lines before search results with / and ?
if [[ "$(command -v bat)" || "$(command -v batcat)" ]]; then
if [[ "$(command -v bat)" ]]; then
alias cat=bat
export PAGER=bat
cmd=bat
else
alias cat=batcat
export PAGER=batcat
cmd=batcat
fi
alias cat=$cmd
export PAGER=$cmd
export BAT_PAGER="less $LESS"
if [[ -n $THEME_PREFER_LIGHT ]]; then
export BAT_THEME="gruvbox-light"
else
export BAT_THEME="gruvbox-dark"
fi
export BAT_PAGER="less $LESS"
export PAGER=bat
## this breaks symlink testing with [ -h ], best not to activate it
# alias -g -- -h='-h 2>&1 | bat --language=help --style=plain'
alias bathelp='bat --language=help --style=plain'
alias bathelp="$cmd --language=help --style=plain"
alias -g -- --help='--help 2>&1 | bathelp '
fi