2018-06-11 17:53:44 +00:00
|
|
|
#set -x # Print out all of the commands that are executing.
|
|
|
|
|
2020-08-09 19:25:35 +00:00
|
|
|
# If not running interactively, don't do anything
|
|
|
|
case $- in
|
|
|
|
*i*) ;;
|
|
|
|
*) return;;
|
|
|
|
esac
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
cd ~
|
|
|
|
|
|
|
|
# Unbreak broken, non-colored terminal.
|
2020-01-25 07:48:35 +00:00
|
|
|
export TERM=xterm-256color
|
2021-02-11 00:44:00 +00:00
|
|
|
color_prompt=yes
|
2020-01-25 07:48:35 +00:00
|
|
|
|
2020-09-30 01:51:11 +00:00
|
|
|
# Load the shell environment.
|
|
|
|
test -f ~/.env.loader && . ~/.env.loader
|
2017-04-07 16:08:45 +00:00
|
|
|
|
2017-04-21 17:35:26 +00:00
|
|
|
# TMP and TEMP are defined in the Windows environment. Leaving them set to the default
|
|
|
|
# Windows temporary directory can have unexpected consequences.
|
|
|
|
export TMP=/tmp
|
|
|
|
export TEMP=/tmp
|
|
|
|
export TMPDIR=/tmp
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Customize the shell prompt.
|
2019-12-31 05:38:46 +00:00
|
|
|
in_git_work_tree() {
|
|
|
|
git rev-parse --is-inside-work-tree &> /dev/null
|
|
|
|
}
|
2017-06-13 14:22:13 +00:00
|
|
|
parse_git_branch() {
|
2019-12-31 05:38:46 +00:00
|
|
|
if in_git_work_tree; then
|
|
|
|
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
|
|
|
|
fi
|
2017-06-13 14:22:13 +00:00
|
|
|
}
|
2022-11-05 04:48:21 +00:00
|
|
|
export PS1='\[\033[0;32m\]\[\033[0m\033[0;32m\]\u\[\033[0;36m\] -> \w\[\033[33m\]\n$(parse_git_branch)\[\033[0;32m\]\[\033[0m\033[0;32m\] \$\[\033[0m\033[0;32m\]\[\033[0m\] '
|
2017-06-13 14:22:13 +00:00
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Git autocompletion.
|
2017-07-17 16:07:02 +00:00
|
|
|
if [ -f ~/.git-completion.bash ]; then
|
|
|
|
. ~/.git-completion.bash
|
|
|
|
# Git autocompletion fixes for bash aliases
|
|
|
|
__git_complete g __git_main
|
|
|
|
__git_complete gco _git_checkout
|
2017-07-19 18:07:40 +00:00
|
|
|
__git_complete gl _git_branch
|
|
|
|
__git_complete gll _git_branch
|
|
|
|
__git_complete gsh _git_branch
|
|
|
|
__git_complete gbd _git_branch
|
2017-07-24 21:41:43 +00:00
|
|
|
__git_complete gpo _git_branch
|
|
|
|
__git_complete grb _git_branch
|
2017-07-17 16:07:02 +00:00
|
|
|
__git_complete gm _git_merge
|
|
|
|
__git_complete gmff _git_merge
|
|
|
|
__git_complete gmnff _git_merge
|
|
|
|
fi
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Don't use ^D to exit.
|
2020-03-15 18:44:36 +00:00
|
|
|
set -o ignoreeof
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Don't put duplicate lines or lines starting with space in the history. See bash(1) for more options.
|
2020-03-15 18:44:36 +00:00
|
|
|
HISTCONTROL=ignoreboth
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Append to the history file.
|
2020-03-15 18:44:36 +00:00
|
|
|
shopt -s histappend
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Customize history.
|
2020-08-09 19:25:35 +00:00
|
|
|
HISTSIZE=20000
|
|
|
|
HISTFILESIZE=20000
|
|
|
|
HISTIGNORE="&:ls:l:ll:[bf]g:less:clear:cls:exit:history:hist"
|
|
|
|
HISTTIMEFORMAT='%F %T '
|
2020-03-15 18:44:36 +00:00
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
|
2020-03-15 18:44:36 +00:00
|
|
|
shopt -s checkwinsize
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Make `less` more friendly for non-text input files, see lesspipe(1).
|
2020-03-15 18:44:36 +00:00
|
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Colored GCC warnings and errors.
|
2020-03-15 18:44:36 +00:00
|
|
|
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
|
2020-08-09 19:25:35 +00:00
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Enable color support in ls.
|
2020-08-09 19:25:35 +00:00
|
|
|
if [ -x /usr/bin/dircolors ]; then
|
|
|
|
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
|
|
|
|
fi
|
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Enable programmable completion features (you don't need to enable
|
|
|
|
# this if it's already enabled in /etc/bash.bashrc and /etc/profile
|
2020-08-09 19:25:35 +00:00
|
|
|
# sources /etc/bash.bashrc).
|
|
|
|
if ! shopt -oq posix; then
|
|
|
|
if [ -f /usr/share/bash-completion/bash_completion ]; then
|
|
|
|
. /usr/share/bash-completion/bash_completion
|
|
|
|
elif [ -f /etc/bash_completion ]; then
|
|
|
|
. /etc/bash_completion
|
|
|
|
fi
|
|
|
|
fi
|
2020-09-30 01:51:11 +00:00
|
|
|
|
2021-02-11 00:44:00 +00:00
|
|
|
# Enable direnv if it exists.
|
|
|
|
if [ -x $GOPATH/bin/direnv.exe ]; then
|
|
|
|
eval "$(direnv.exe hook bash)"
|
|
|
|
fi
|
|
|
|
|