Add configuration for bat
This commit is contained in:
parent
a26c6e0263
commit
1272f73dcd
4 changed files with 35 additions and 1 deletions
16
.config/bat/config
Normal file
16
.config/bat/config
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
--theme="ansi"
|
||||
|
||||
# See $PAGER in ~/.config/shell/env
|
||||
--pager="less --chop-long-lines --ignore-case --LONG-PROMPT --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"
|
||||
|
|
@ -7,6 +7,11 @@
|
|||
alias dotfiles='git --git-dir=$XDG_DATA_HOME/dotfiles --work-tree=$HOME'
|
||||
|
||||
|
||||
if _command_exists batcat; then
|
||||
alias bat='batcat'
|
||||
fi
|
||||
|
||||
|
||||
# Integrate `git`
|
||||
if _command_exists git; then
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export XDG_DATA_HOME="$HOME/.local/share" # also set in ~/.local/bin/install-do
|
|||
export XDG_STATE_HOME="$HOME/.local/state"
|
||||
|
||||
# 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/install-dotfiles
|
||||
|
||||
|
||||
# Convenient names for various places in the system
|
||||
|
|
@ -28,8 +28,14 @@ export PAGER="less --chop-long-lines --ignore-case --LONG-PROMPT --no-init --sta
|
|||
export TZ="Europe/Berlin"
|
||||
export VISUAL=$EDITOR
|
||||
|
||||
if command -v bat >/dev/null 2>&1; then
|
||||
export MANPAGER="sh -c 'col -bx | bat --language man --plain'"
|
||||
export MANROFFOPT="-c"
|
||||
fi
|
||||
|
||||
|
||||
# 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 VIMINIT='let $MYVIMRC="'"$XDG_CONFIG_HOME"'/vim/vimrc" | source $MYVIMRC'
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
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
|
||||
|
||||
DOTFILES_DIR="$XDG_DATA_HOME/dotfiles" # also set in ~/.config/shell/env
|
||||
|
|
@ -96,6 +97,12 @@ _git config --local status.showUntrackedFiles no
|
|||
_git remote set-url origin "$DOTFILES_SSH"
|
||||
|
||||
|
||||
if command -v batcat >/dev/null 2>&1 && ! command -v bat >/dev/null 2>&1; then
|
||||
mkdir -p "$XDG_BIN_HOME"
|
||||
ln -sf "$(command -v batcat)" "$XDG_BIN_HOME/bat"
|
||||
fi
|
||||
|
||||
|
||||
echo ""
|
||||
echo "The dotfiles were installed successfully (branch: $DOTFILES_BRANCH)"
|
||||
echo ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue