export GPG_TTY=$(tty) # 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="/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 ruby_prefix=$(brew --prefix ruby)/bin export PATH=$ruby_prefix/bin:$PATH # rubygems # Bash completion [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh" # Set the terminal into 256 color mode export TERM=xterm-256color # 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 /usr/local/etc/bash_completion.d/git-completion.bash ]; 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' # Go Stuff export GOPATH=$HOME/.go mkdir -p "$GOPATH/{src,bin}" export GOBIN=$GOPATH/bin env_gopath=$(go env GOPATH) export PATH=$PATH:/usr/local/opt/go/libexec/bin:$GOBIN:$env_gopath # Editors export EDITOR=vim # History Management shopt -s histappend export HISTCONTROL=ignoredups:erasedups export HISTSIZE=1000 #export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" # Keep TAR from tarring-up resource forks export COPYFILE_DISABLE=true # Miscellaneous aliases 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 install_kitty='curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin' if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi # Helper vars export PEKKA='git+ssh://pekka.land/var/git' export MEOW='git@github.com:meowgorithm' export MAGIC='git@github.com:magicnumbers' export BIT='https://meowgorithm@bitbucket.org/meowgorithm' export GITLAB='git@gitlab.com:meowgorithm' export CHARM='git@github.com:charmbracelet' # Git export GOPRIVATE="github.com/charmbracelet" export GOPRIVATE="github.com/magicnumbers" # 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 # shellcheck source=/usr/local/etc/profile.d/z.sh [[ -f $(brew --prefix)/etc/profile.d/z.sh ]] && . "$(brew --prefix)/etc/profile.d/z.sh" # PIP + Virtualenv Stuff #VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper.sh LAZY_VIRTUALENVWRAPPER_SCRIPT=/usr/local/bin/virtualenvwrapper_lazy.sh if [ -f $LAZY_VIRTUALENVWRAPPER_SCRIPT ]; then export PIP_REQUIRE_VIRTUALENV=true export PIP_RESPECT_VIRTUALENV=true export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python export PIP_LOG_FILE="$HOME/.cache/pip-log.txt" # Don't litter pip_log.txt in cwd please export WORKON_HOME=~/.virtualenvs # shellcheck source=/usr/local/bin/virtualenvwrapper_lazy.sh 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 ) ) if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi if [ -f /usr/local/bin/vim ]; then alias vim='/usr/local/bin/vim' alias vless='/usr/local/share/vim/vim73/macros/less.sh' fi } 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