We already use auto-capitalisation in the shell, so we actually benefit from having capitalised names, considering it reduces headaches induced by hardcoded paths. Also, now that we've accepted that the home directory will be a mess, it will aid standing out. Also source the file in .profile, because it should've been from the start.
59 lines
1.9 KiB
Bash
59 lines
1.9 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"
|
|
export LANG="en_GB.UTF-8"
|
|
|
|
# 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
|
|
[ -r "$XDG_CONFIG_HOME/user-dirs.dirs" ] && . "$XDG_CONFIG_HOME/user-dirs.dirs"
|
|
|
|
# I am not going to set environment variables such as HISTFILE,
|
|
# Since, cleaning up my $HOME is a losing battle, *every* application
|
|
# will put its crap there.
|
|
|
|
# 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=auto
|
|
|
|
# Load the SSH agent
|
|
[ -z "$SSH_AUTH_SOCK" ] && {
|
|
eval "$(ssh-agent -s)" >/dev/null
|
|
ssh-add "$HOME/.ssh/github" >/dev/null 2>&1
|
|
ssh-add "$HOME/.ssh/gitea" >/dev/null 2>&1
|
|
ssh-add "$HOME/.ssh/admin@homeserver" >/dev/null 2>&1
|
|
}
|
|
|
|
#shellcheck disable=SC1091
|
|
# Source ~/.bashrc, when in interactive mode, but not POSIX/sh mode.
|
|
[ "$BASH" ] &&
|
|
[ "$PS1" ] &&
|
|
[ -z "$POSIXLY_CORRECT" ] &&
|
|
[ "${0#-}" != 'sh' ] &&
|
|
[ -r "$HOME/.bashrc" ] &&
|
|
. "$HOME/.bashrc"
|