dotfiles/dotfiles/.bashrc

47 lines
1.4 KiB
Bash

# vim: set ft=sh:
# If not running interactively, don't do anything.
[[ $- != *i* ]] && return
# Source global definitions.
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Append to history, don't overwrite.
shopt -s histappend
# Load customizations.
[[ -f $HOME/.bash_aliases ]] && source "$HOME/.bash_aliases"
[[ -f $HOME/.bash_colors ]] && source "$HOME/.bash_colors"
[[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions"
# Set up python env.
export PYTHONDONTWRITEBYTECODE=1
export PYTHONUSERBASE=$HOME/.env/python
# Local user bins
appendpath $HOME/.local/bin
appendpath $HOME/.cargo/bin
appendpath $HOME/.env/python/bin
# Save working dir on every prompt.
export PROMPT_COMMAND='pwd > $HOME/.cwd'
export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ "
# Use fzf if installed.
hash fzf 2>/dev/null && eval "$(fzf --bash)"
export FZF_DEFAULT_OPTS='--border=horizontal --info=inline --no-reverse --height=50%'
# Change to saved working dir.
[[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"
# Use gpg-agent as ssh agent (and get a nice graphical prompt).
unset SSH_AGENT_PID
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export SSH_AUTH_SOCK
fi
GPG_TTY=$(tty)
export GPG_TTY
gpg-connect-agent updatestartuptty /bye >/dev/null