|
# This is for OSX |
|
|
|
tput colors > /dev/null |
|
if [ "$?" == "0" ]; then |
|
color_prompt="yes" |
|
fi |
|
|
|
export CLICOLOR=1 |
|
export LSCOLORS=ExFxCxDxBxegedabagacad |
|
|
|
source /usr/local/etc/bash_completion.d/git-completion.bash |
|
source /usr/local/etc/bash_completion.d/git-prompt.sh |
|
source /usr/local/etc/bash_completion # brew install bash_completion for this |
|
## source /usr/local/go/misc/bash/go # bash completion for go command |
|
# The next line enables bash completion for gcloud. |
|
#source /Users/aroman/sdk/google-cloud-sdk/completion.bash.inc |
|
|
|
source ~/.aliases |
|
|
|
if [ "$color_prompt" = yes ]; then |
|
# If it's an interactive shell, update the prompt: |
|
LAST_COMMAND='$(if [ "$?" = 0 ]; then echo "\[\e[1;32m\](✔)"; else echo "\[\e[1;31m\](✘)"; fi)' |
|
GIT_BRANCH_IF_AVAILABLE='$(__git_ps1 "\[\e[1;36m\]%s\[\e[0m\] ")' |
|
HOST_AND_PATH='${debian_chroot:+($debian_chroot)}\[\e[0;32m\]\h\[\e[0m\] \[\e[1;35m\]\w\[\e[0m\]' |
|
FINAL_PROMPT='\$ \[\e[1;33m\]' |
|
PS1=${LAST_COMMAND}' '${HOST_AND_PATH}' '${GIT_BRANCH_IF_AVAILABLE}${FINAL_PROMPT} |
|
# Reset color immediately after hitting enter |
|
trap "echo -n $'\e[0m' > $(tty)" DEBUG |
|
fi |
|
unset color_prompt force_color_prompt |
|
|
|
# Perform file completion in a case insensitive fashion |
|
bind "set completion-ignore-case on" |
|
# Treat hyphens and underscores as equivalent |
|
bind "set completion-map-case on" |
|
|
|
## History management ## |
|
# Append to the history file, don't overwrite it |
|
shopt -s histappend |
|
# Save multi-line commands as one command |
|
shopt -s cmdhist |
|
# Huge history |
|
export HISTSIZE=100000 |
|
export HISTFILESIZE=100000 |
|
# Avoid duplicate entries |
|
export HISTCONTROL="erasedups:ignoreboth" |
|
# Don't record some commands |
|
export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history" |
|
# Record each line as it gets issued -- this screws up the new terminal dir. |
|
export PROMPT_COMMAND='history -a;update_terminal_cwd' |
|
# Useful timestamp format |
|
export HISTTIMEFORMAT='%F %T ' |
|
|
|
# Correct spelling errors during tab-completion |
|
# shopt -s dirspell |
|
# Correct spelling errors in arguments supplied to cd |
|
shopt -s cdspell |
|
# This defines where cd looks for targets |
|
# Add the directories you want to have fast access to, separated by colon |
|
# Ex: CDPATH=".:~:~/projects" will look for targets in the current working directory, in home and in the ~/projects folder |
|
CDPATH="." |
|
# This allows you to bookmark your favorite places across the file system |
|
# Define a variable containing a path and you will be able to cd into it regardless of the directory you're in |
|
shopt -s cdable_vars |
|
# Examples: |
|
# export dotfiles="$HOME/dotfiles" |
|
# export projects="$HOME/projects" |
|
# export documents="$HOME/Documents" |
|
# export dropbox="$HOME/Dropbox" |
|
|
|
|
|
export GOPATH=$HOME/go |
|
export PATH=/usr/local/bin:${PATH}:$HOME/bin:$HOME/go/bin:/usr/local/share/npm/bin |
|
export EDITOR="sublime_text -n -w" |
|
|
|
# Up/down completes via history rather than merely scroll blindly through hist. |
|
bind '"\e[A": history-search-backward' |
|
bind '"\e[B": history-search-forward' |
|
|
|
# The next line updates PATH for the Google Cloud SDK. |
|
source '/Users/aroman/code/google-cloud-sdk/path.bash.inc' |
|
|
|
# The next line enables shell command completion for gcloud. |
|
source '/Users/aroman/code/google-cloud-sdk/completion.bash.inc' |
|
|
|
# For brew: It puts some binaries in sbin. |
|
export PATH="/usr/local/sbin:$PATH" |