Add configuration for bat
This commit is contained in:
parent
94aa2f3557
commit
fbc2e0695a
4 changed files with 40 additions and 0 deletions
5
.config/bat/README.md
Normal file
5
.config/bat/README.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# `bat`-related Configurations
|
||||
|
||||
This folder contains
|
||||
the [config](./config) for [`bat`](https://github.com/sharkdp/bat),
|
||||
found via `$BAT_CONFIG_PATH` set in [`~/.config/shell/env`](../shell/env).
|
||||
17
.config/bat/config
Normal file
17
.config/bat/config
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
--theme="ansi"
|
||||
|
||||
# See `$LESS` in ~/.config/shell/env
|
||||
--pager="less --chop-long-lines --ignore-case --LONG-PROMPT --no-init --quit-if-one-screen --RAW-CONTROL-CHARS --status-column"
|
||||
|
||||
--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"
|
||||
|
|
@ -47,6 +47,18 @@ export LESS="--chop-long-lines --ignore-case --LONG-PROMPT --no-init --quit-if-o
|
|||
[ -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
|
||||
|
||||
export BAT_CONFIG_PATH="$XDG_CONFIG_HOME/bat/config"
|
||||
export LESSHISTFILE="$XDG_STATE_HOME/less/history"
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
set -eu
|
||||
|
||||
|
||||
XDG_BIN_HOME="${XDG_BIN_HOME:-$HOME/.local/bin}"
|
||||
XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
|
||||
|
|
@ -127,6 +128,11 @@ _git checkout --force "$DOTFILES_BRANCH"
|
|||
_git config --local status.showUntrackedFiles no
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
# Keep only the most recent backups
|
||||
_keep=10
|
||||
if [ -d "$BACKUPS_DIR" ]; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue