Files
.dotfiles/.profile
Quinn f02053513e Move PATH and EDITOR configurations above XDG configurations.
This prioritises more shell-specific configurations to be earlier.
Good for when we add more configurations, such as LANG or HISTSIZE.
2026-01-12 15:28:23 +01:00

45 lines
1.4 KiB
Bash

#!/usr/bin/env sh
#
# ~/.profile
# Sourced once per login by most shells.
# Some shells, such as csh may use a symlink from ~/.login instead.
# Used to set important variables, such as PATH, XDG_ and alike.
#
export PATH=".local/bin:$PATH"
# Use neovim for editor whenever available.
type nvim >/dev/null && {
export EDITOR='nvim'
export VISUAL='nvim'
export MANPAGER='nvim +Man!'
}
# Read https://specifications.freedesktop.org/basedir-spec/latest/
# or https://wiki.archlinux.org/title/XDG_Base_Directory
# for more information about these values.
# Default Analogous to
export XDG_CONFIG_HOME="$HOME/.config" # ~/.config /etc
export XDG_DATA_HOME="$HOME/.local/share" # ~/.local/share /usr/share
export XDG_STATE_HOME="$HOME/.var/lib" # ~/.local/state /var/lib
export XDG_CACHE_HOME="$HOME/.var/cache" # ~/.cache /var/cache
# Create symlinks from the defaults to our configured locations
# Since, not all applications follow the XDG base directory rules.
[ -L "$HOME/.local/state" ] ||
ln -sf "$XDG_STATE_HOME" "$HOME/.local/state"
[ -L "$HOME/.cache" ] ||
ln -sf "$XDG_CACHE_HOME" "$HOME/.cache"
# coloured GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# if executing interactively
# execute .bashrc in the current login context
case $- in
*i*) ;;
*) return ;;
esac
[ -z "${PS1-}" ] && return
[ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc"