Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
178 lines (128 sloc) 5.35 KB
# shellcheck disable=SC2148
# ========================================================================
# Evan's ZSH config from hell (it's really simple and harmless actually)
# ========================================================================
# call me maybe? set -eo pipefail
# Locale setup
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# ------------------------------------------------------------------------
# Oh-My-ZSH!!
# ------------------------------------------------------------------------
export HOME=~
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set to the name theme to load.
# Look in ~/.oh-my-zsh/themes/
export ZSH_THEME="gozilla"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# export DISABLE_LS_COLORS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
# shellcheck disable=SC2034
plugins=(git git-flow brew github osx)
# meat-and-potatoes
# shellcheck disable=SC1090
source $ZSH/oh-my-zsh.sh
# modify prompt -- this is theme-specific
# shellcheck disable=SC2016
export PROMPT='%{$fg_bold[green]%}%n@%{$fg_bold[green]%}%m %{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
# funcs/completions
fpath=($HOME/.zsh/func $fpath)
typeset -U fpath
# enable editing via v cmd
autoload edit-command-line; zle -N edit-command-line
bindkey -M vicmd v edit-command-line
# ------------------------------------------------------------------------
# Globals
# ------------------------------------------------------------------------
export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
export CONFDIR=$HOME/.zshrc.d
export LIBDIR=$CONFDIR/lib
export HOSTNAME
HOSTNAME=$(hostname)
# ------------------------------------------------------------------------
# Common functions
# ------------------------------------------------------------------------
# clean up the $PATH and remove the specified path
function remove-path {
cleanpath=$(echo "${PATH}" |
tr ':' '\n' |
awk '{a[$0]++;if (a[$0]==1){b[max+1]=$0;max++}}END{for (x = 1; x <= max; x++) { print b[x] } }' |
grep -v "${1}" |
tr '\n' ':' |
sed -e 's/:$//')
export PATH=$cleanpath
}
function prepend-path {
remove-path "${1}"
export PATH=$1:$PATH
}
function append-path {
remove-path "${1}"
export PATH=$PATH:$1
}
function source-if-exists {
# shellcheck disable=SC1090
[[ -s "${1}" ]] && source "${1}"
}
# ------------------------------------------------------------------------
# Tmuxinator
# ------------------------------------------------------------------------
if [[ -s ~/devel/tmuxinator/completion ]]; then
# shellcheck disable=SC1090
source ~/devel/tmuxinator/completion/tmuxinator.zsh
fi
# ------------------------------------------------------------------------
# VIM!
# ------------------------------------------------------------------------
export EDITOR='vim'
# ------------------------------------------------------------------------
# Path
# ------------------------------------------------------------------------
# reset path to make sure system-provided programs do not take precedence over
# user-installed alternatives
prepend-path /usr/local/share/npm/bin
prepend-path /opt/local/bin
prepend-path /usr/local/sbin
prepend-path /usr/local/bin
prepend-path "${HOME}"/bin
# ------------------------------------------------------------------------
# Python
# ------------------------------------------------------------------------
#
export PYTHONSTARTUP=$HOME/.pythonrc.py
# ------------------------------------------------------------------------
# jstdutil
# ------------------------------------------------------------------------
export JSTESTDRIVER_HOME=$HOME/bin/jstd
# ------------------------------------------------------------------------
# NPM completion
# ------------------------------------------------------------------------
# this is a weird path, but we want this so bark if it doens't exist
#source ~/local/node/lib/node_modules/npm/lib/utils/completion.sh
# ------------------------------------------------------------------------
# common settings
# ------------------------------------------------------------------------
# shellcheck disable=SC1090
source $CONFDIR/common.zsh
# ------------------------------------------------------------------------
# environment-specific settings
# ------------------------------------------------------------------------
# This will load any configuration (file w/ .zsh extension) that matches
# the hostname for this box. For shared configurations between hostnames
# just create a symlink for the hostname to the share file.
# For example, I name the files genericly then just symlink the hostname
# to the canonical configuration file for a given environment.
#
# mylaptop.local -> local.zsh
# some.host.with.fqdn.com -> my_server.zsh
# override the hostname being reset by DHCP to something like eculver-2.local
hostname | grep -q 'local'
[[ $? -eq 0 ]] && HOSTNAME=eculver.local
# shellcheck disable=SC1090
[[ -d $CONFDIR ]] && [[ -s $CONFDIR/$HOSTNAME ]] && source $CONFDIR/$HOSTNAME