#!/usr/local/bin/bash
#
# FILE  : dotfiles.core/home/.bashrc
# TARGET: ~/.bashrc
# AUTHOR: tgwil
#
# This is the core Bash configuration for all TGWIL accounts on all
# systems. It contains only those configurations which are applicable
# to (almost) every situation. Situational configurations should go
# in their respective situational repositories.


########################################################################
## Test for interactive shell
########################################################################
if [[ $- != *i* ]]; then
	return
fi


########################################################################
## Bash completion
########################################################################
[[ $PS1 && -f /usr/local/share/bash-completion/bash_completion.sh ]] \
    && source /usr/local/share/bash-completion/bash_completion.sh


########################################################################
## History
########################################################################
# Don't put duplicates or lines starting with spaces in history.
HISTCONTROL=ignoreboth

# Append to history file; don't overwrite
shopt -s histappend

# History size
HISTSIZE=100000      #100K
HISTFILESIZE=1000000 #1M


########################################################################
## Editor
########################################################################
export EDITOR="nano"
if id -nG $USER | grep -qw "sudo" -qw; then export SUDO_EDITOR=$EDITOR; fi

export VISUAL="emacsclient -c"
if id -nG $USER | grep -qw "sudo" -qw; then export SUDO_VISUAL=$VISUAL; fi


########################################################################
## GPG
########################################################################
GPG_TTY=$(tty)
export GPG_TTY


########################################################################
## Load ~/.bash_aliases
########################################################################
if [[ $- == *i* && -f ~/.bash_aliases ]]; then
	. ~/.bash_aliases
fi