Last active
May 13, 2016 14:23
-
-
Save nabrahamson/231991876f78d82a7e9dec8c28c5b2f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
export _sys | |
_sys=$(uname -s) | |
[[ $_sys == 'Darwin' ]] && export _is_mac=1 | |
[[ $_sys == 'Linux' ]] && export _is_linux=1 | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
shopt -s globstar | |
# enable color support of ls and also add handy aliases | |
function _handy_aliases { | |
[[ -r ~/.dircolors ]] && eval "$(${1}dircolors -b ~/.dircolors)" || eval "$(${1}dircolors -b)" | |
alias ls="${1}ls --color=auto" | |
alias grep="${1}grep --color=auto" | |
} | |
_handy_aliases $([[ -n $_is_mac ]] && echo "g") | |
# some more ls aliases | |
alias ll='ls -alFh' | |
alias la='ls -A' | |
alias l='ls -CF' | |
# git aliases | |
alias gitl='git log --graph --decorate --color' | |
# Bash auto completion | |
if [[ -n $_is_mac ]] && [[ -f `brew --prefix`/etc/bash_completion ]]; then | |
. `brew --prefix`/etc/bash_completion | |
fi | |
# vim mode... | |
set -o vi | |
export EDITOR=nvim | |
# vim alias | |
alias vim='nvim' | |
# Fancy prompt | |
if [[ -z $SSH_CLIENT ]]; then | |
export TERM="screen-256color" | |
export POWERLINE_FONT=1 | |
fi | |
# Setup git_ps1 options | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWSTASHSTATE=1 | |
export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
# Version managers | |
function _setup_dev_tools { | |
local _last_status=$? | |
(exit $_last_status) # Reset status to capture errors | |
} | |
_setup_dev_tools | |
export PATH="$HOME/.local/bin:$PATH" | |
# Source additional scripts and overrides (including prompt.bash) | |
for f in $HOME/.bash/*.bash; do | |
source "$f" | |
done | |
# Environment variables for python development | |
export WORKON_HOME=$HOME/.virtualenvs | |
export PROJECT_HOME=$HOME/Projects | |
source /usr/bin/virtualenvwrapper.sh | |
# Environment variables for docker | |
export DOCKER_TLS_VERIFY="1" | |
export DOCKER_MACHINE_NAME="dev" | |
# Cleanup | |
unset _sys _is_mac _is_linux _handy_aliases _setup_dev_tools |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment