# Path export PATH="/usr/local/bin:/usr/local/sbin:$PATH" export PATH="/usr/local/share/npm/bin:$PATH" export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH" export PATH=$(brew --prefix ruby)/bin:$PATH # rubygems export PATH="/usr/local/opt/python/libexec/bin:$PATH" # Homebrew Python (typically 3) export PATH="$HOME/Library/Python/3.6/bin:$PATH" # Python 3 bin export PATH="$HOME/.local/bin:$PATH" # Stack (Haskell) puts stuff here export PATH="$HOME/.cabal/bin:$PATH" # Cabal (Haskell) puts stuff here # Bash completion (via Homebrew) [[ -f `brew --prefix`/etc/bash_completion ]] && . `brew --prefix`/etc/bash_completion # Set the terminal into 256 color mode export TERM=xterm-256color # Variables for later VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh LAZY_VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper_lazy.sh GIT_BASH_COMPLETION_SCRIPT=/usr/local/etc/bash_completion.d/git-completion.bash BREW_BASH_COMPLETION_SCRIPT=/usr/local/etc/bash_completion.d/brew_bash_completion.sh # Shorten the pwd in the prompt to show only the n number of characters # NOTE: Bash 4+ only PROMPT_DIRTRIM=2 # Ascii color escape codes # Note that 256 color foreground codes follow the following format: # SAMPLE_256_COLOR="\[\e[38;05;255m\]" RED="\[\e[0;31m\]" GREEN="\[\e[0;32m\]" YELLOW="\[\e[0;33m\]" BLUE="\[\e[0;34m\]" PURPLE="\[\e[0;35m\]" CYAN="\[\e[0;36m\]" LIGHT_GREEN="\[\e[1;32m\]" WHITE="\[\e[1;37m\]" LIGHT_GRAY="\[\e[0;37m\]" COLOR_NONE="\[\e[0m\]" # Format the prompt function prompt_func() { # Show Git branch in prompt if [ -f $GIT_BASH_COMPLETION_SCRIPT ]; then export GIT_PS1_SHOWDIRTYSTATE=true export GIT_PS1_SHOWUNTRACKEDFILES=true export GIT_PS1_SHOWSTASHSTATE=true git_branch=$(__git_ps1 " (%s)") fi # Python: Show virtualenv in prompt if [ -z $VIRTUAL_ENV ]; then virtualenv="" else virtualenv="(`basename \"$VIRTUAL_ENV\"`) " fi PS1="${YELLOW}${virtualenv}${CYAN}\h:${RED}\w${CYAN} \u${YELLOW}${git_branch}${RED} \$${COLOR_NONE} " } # Format the prompt PROMPT_COMMAND=prompt_func # Enable Vi mode in Bash #set -o vi # Miscellaneous coloring and formatting export CLICOLOR=1 export LSCOLORS=dxfxcxdxbxegedabagacad alias ls='ls -h' # Git bash completion if [ -f $GIT_BASH_COMPLETION_SCRIPT ]; then source $GIT_BASH_COMPLETION_SCRIPT fi # Go Stuff export GOPATH=$HOME/.go mkdir -p $GOPATH/{src,bin} export GOBIN=$GOPATH/bin export PATH=$PATH:/usr/local/opt/go/libexec/bin:$GOBIN:$(go env GOPATH) # Editors export EDITOR=vim # History Management export HISTCONTROL=erasedups export HISTSIZE=500 shopt -s histappend # Keep TAR from tarring-up resource forks export COPYFILE_DISABLE=true # Miscellaneous aliases alias h='history' alias g='grep' alias a='ack' alias mancat='man cat' alias redis-server='redis-server /usr/local/etc/redis.conf' alias mongotail='tail -f /usr/local/var/log/mongodb/mongo.log' alias apache='sudo apachectl' alias flushdns='sudo dscacheutil -flushcache && dscacheutil -flushcache' alias postgres='postgres -D /usr/local/var/postgres' alias tail_postgres='tail -f /usr/local/var/log/postgres.log' alias tree='tree -C' alias lock_pip='export PIP_REQUIRE_VIRTUALENV=true' alias unlock_pip='export PIP_REQUIRE_VIRTUALENV=false' alias delete_pyc='find . -name '*.pyc' -delete' alias delete_orig='find . -name '*.orig' -delete' alias rc='source ~/.bashrc' alias kittyconf='vim /Users/christian/Library/Preferences/kitty/kitty.conf' alias stt='kitty @ set-tab-title' alias install_kitty='curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin' alias throttle_dropbox='sudo cputhrottle $(pgrep -o Dropbox) 20' # Helper vars export MEOW='git@github.com:meowgorithm' export MAGIC='git@github.com:magicnumbers' export BIT='https://meowgorithm@bitbucket.org/meowgorithm' export PEKKA='git+ssh://pekka.land/var/git' if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi # Print local network adapter IPs and copy them to the clipboard alias en0="ipconfig getifaddr en0 | pbcopy && ipconfig getifaddr en0" alias en1="ipconfig getifaddr en1 | pbcopy && ipconfig getifaddr en1" # Initialize Z [[ -f `brew --prefix`/etc/profile.d/z.sh ]] && . `brew --prefix`/etc/profile.d/z.sh # PIP + Virtualenv Stuff if [ -f $VIRTUALENVWRAPPER_SCRIPT ]; then export PIP_REQUIRE_VIRTUALENV=true export PIP_RESPECT_VIRTUALENV=true #export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python export PIP_LOG_FILE='~/.cache/pip-log.txt' # Don't litter pip_log.txt in cwd please export WORKON_HOME=~/.virtualenvs source $LAZY_VIRTUALENVWRAPPER_SCRIPT fi ### Begin PIP Bash completion ### # Install the following with: # `pip completion --bash >> ~/.profile _pip_completion() { COMPREPLY=( $( COMP_WORDS="${COMP_WORDS[*]}" \ COMP_CWORD=$COMP_CWORD \ PIP_AUTO_COMPLETE=1 $1 ) ) } complete -o default -F _pip_completion pip ### End PIP Bash completion ### # Cute apple logo [[ -f `brew --prefix`/bin/archey ]] && archey --color # Colored man pages export LESS_TERMCAP_mb=$'\E[01;31m' export LESS_TERMCAP_md=$'\E[01;31m' export LESS_TERMCAP_me=$'\E[0m' export LESS_TERMCAP_se=$'\E[0m' export LESS_TERMCAP_so=$'\E[01;44;33m' export LESS_TERMCAP_ue=$'\E[0m' export LESS_TERMCAP_us=$'\E[01;32m' # direnv # See: https://direnv.net if hash direnv 2>/dev/null; then eval "$(direnv hook bash)" fi # FZF export FZF_DEFAULT_OPTS='--margin=1,2,0,2 --height=20 --inline-info --border' # Homebrew/FZF if [ -f /usr/local/bin/fzf ]; then function brew_info { local inst=$(brew search | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[brew:info]'") if [[ $inst ]]; then for prog in $(echo $inst) do brew info $prog done fi } fi ###-begin-npm-completion-### # # npm command completion script # # Installation: npm completion >> ~/.bashrc (or ~/.zshrc) # Or, maybe: npm completion > /usr/local/etc/bash_completion.d/npm if type complete &>/dev/null; then _npm_completion () { local words cword if type _get_comp_words_by_ref &>/dev/null; then _get_comp_words_by_ref -n = -n @ -w words -i cword else cword="$COMP_CWORD" words=("${COMP_WORDS[@]}") fi local si="$IFS" IFS=$'\n' COMPREPLY=($(COMP_CWORD="$cword" \ COMP_LINE="$COMP_LINE" \ COMP_POINT="$COMP_POINT" \ npm completion -- "${words[@]}" \ 2>/dev/null)) || return $? IFS="$si" } complete -o default -F _npm_completion npm elif type compdef &>/dev/null; then _npm_completion() { local si=$IFS compadd -- $(COMP_CWORD=$((CURRENT-1)) \ COMP_LINE=$BUFFER \ COMP_POINT=0 \ npm completion -- "${words[@]}" \ 2>/dev/null) IFS=$si } compdef _npm_completion npm elif type compctl &>/dev/null; then _npm_completion () { local cword line point words si read -Ac words read -cn cword let cword-=1 read -l line read -ln point si="$IFS" IFS=$'\n' reply=($(COMP_CWORD="$cword" \ COMP_LINE="$line" \ COMP_POINT="$point" \ npm completion -- "${words[@]}" \ 2>/dev/null)) || return $? IFS="$si" } compctl -K _npm_completion npm fi ###-end-npm-completion-### # The next line updates PATH for the Google Cloud SDK. if [ -f "$HOME/Code/google-cloud-sdk/path.bash.inc" ]; then . "$HOME/Code/google-cloud-sdk/path.bash.inc"; fi # The next line enables shell command completion for gcloud. if [ -f "$HOME/Code/google-cloud-sdk/completion.bash.inc" ]; then . "$HOME/Code/google-cloud-sdk/completion.bash.inc"; fi # Nix if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi