- Follow XDG standard: ~/.config and ~/.local folders - Set environment variables and define aliases within ~/.config/shell - Add installation script for easy setup and maintenance (i.e., `dotfiles-install` and `dotfiles-update`) - Add README.md with info on the installation and general notes
52 lines
1.4 KiB
Shell
52 lines
1.4 KiB
Shell
#!/bin/sh
|
|
|
|
# Environment variables for all kinds of shells
|
|
|
|
|
|
# Standard XDG base directories
|
|
# See: https://wiki.archlinux.org/title/XDG_Base_Directory
|
|
|
|
export XDG_CACHE_HOME="$HOME/.cache"
|
|
export XDG_CONFIG_HOME="$HOME/.config"
|
|
export XDG_DATA_HOME="$HOME/.local/share"
|
|
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"
|
|
|
|
|
|
# Convenient names for various places in the system,
|
|
# shown here not only to be used but also document things
|
|
|
|
export DOTFILES_DIR="$XDG_DATA_HOME/dotfiles"
|
|
export DOTFILES_HTTPS="https://code.webartifex.de/alexander/dotfiles"
|
|
export DOTFILES_SSH="git@git.webartifex.de:alexander/dotfiles.git"
|
|
|
|
|
|
# Generic shell configs
|
|
|
|
|
|
# Fall back to a widely known terminal type
|
|
# if this host lacks the terminfo entry for `$TERM`
|
|
# (e.g., `alacritty` over `ssh` on a fresh server)
|
|
if _command_exists infocmp && ! infocmp "$TERM" >/dev/null 2>&1; then
|
|
export TERM=xterm-256color
|
|
fi
|
|
|
|
|
|
[ -t 0 ] && export GPG_TTY=$(tty)
|
|
|
|
|
|
export EDITOR=nano
|
|
|
|
|
|
export PAGER=less
|
|
export LESS="--chop-long-lines --ignore-case --LONG-PROMPT --no-init --quit-if-one-screen --RAW-CONTROL-CHARS --status-column"
|
|
|
|
|
|
[ -f "$XDG_CONFIG_HOME/shell/locale" ] && . "$XDG_CONFIG_HOME/shell/locale"
|
|
|
|
|
|
# Move common tools' config and cache files into XDG directories
|
|
|
|
export LESSHISTFILE="$XDG_STATE_HOME/less/history"
|