Watch
1
0
Fork
You've already forked dotfiles
0

Add configuration for bat

This commit is contained in:
Alexander Hess 2026-08-03 02:57:48 +02:00
commit 7a5d1d5e46
Signed by: alexander
GPG key ID: B46EDB4DFC26805D
3 changed files with 36 additions and 1 deletions

17
.config/bat/config Normal file
View file

@ -0,0 +1,17 @@
--theme="ansi"
# See $PAGER in ~/.config/shell/env
--pager="less --chop-long-lines --ignore-case --LONG-PROMPT --no-init --status-column --quit-if-one-screen --RAW-CONTROL-CHARS"
--style="numbers,changes,header"
# Unrecognized mappings
--map-syntax ".bash_history:Bourne Again Shell (bash)"
--map-syntax "**/bash/history:Bourne Again Shell (bash)"
--map-syntax "**/zsh/history:Bourne Again Shell (bash)"
--map-syntax ".flake8:INI"
--map-syntax "poetry.lock:TOML"

View file

@ -12,7 +12,7 @@ export XDG_DATA_HOME="$HOME/.local/share" # also set in ~/.local/bin/dotfiles-{
export XDG_STATE_HOME="$HOME/.local/state" export XDG_STATE_HOME="$HOME/.local/state"
# Make up a XDG directory for binaries (that does not exist in the standard) # Make up a XDG directory for binaries (that does not exist in the standard)
export XDG_BIN_HOME="$HOME/.local/bin" export XDG_BIN_HOME="$HOME/.local/bin" # also set in ~/.local/bin/dotfiles-install
# Convenient names for various places in the system # Convenient names for various places in the system
@ -33,6 +33,18 @@ export LESS="--chop-long-lines --ignore-case --LONG-PROMPT --no-init --raw-contr
[ -f "$XDG_CONFIG_HOME/shell/locale" ] && . "$XDG_CONFIG_HOME/shell/locale" [ -f "$XDG_CONFIG_HOME/shell/locale" ] && . "$XDG_CONFIG_HOME/shell/locale"
# ~/.local/bin/dotfiles-install symlinks Debian's `batcat` to ~/.local/bin/bat
for _bat in batcat bat; do
if _command_exists "$_bat"; then
export MANPAGER="sh -c 'col -bx | $_bat --language man --plain'"
export MANROFFOPT="-c"
break
fi
done
unset _bat
# Move common tools' config and cache files into XDG directories # Move common tools' config and cache files into XDG directories
export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config"
export LESSHISTFILE="$XDG_STATE_HOME/less/history" export LESSHISTFILE="$XDG_STATE_HOME/less/history"

View file

@ -10,6 +10,7 @@
set -eu set -eu
XDG_BIN_HOME="${XDG_BIN_HOME:-$HOME/.local/bin}" # also set in ~/.config/shell/env
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" # also set in ~/.config/shell/env XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" # also set in ~/.config/shell/env
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" # also set in ~/.config/shell/env XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" # also set in ~/.config/shell/env
@ -107,6 +108,11 @@ _git config --local status.showUntrackedFiles no
_git remote set-url origin "$DOTFILES_SSH" _git remote set-url origin "$DOTFILES_SSH"
if command -v batcat >/dev/null 2>&1 && ! command -v bat >/dev/null 2>&1; then
ln -sf "$(command -v batcat)" "$XDG_BIN_HOME/bat"
fi
echo "" echo ""
echo "The dotfiles were installed successfully (branch: $DOTFILES_BRANCH)" echo "The dotfiles were installed successfully (branch: $DOTFILES_BRANCH)"
echo "" echo ""