-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
153 lines (117 loc) · 4.38 KB
/
zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set backup prompt in case zsh theme fails to load.
PROMPT=[%n@$(hostname -s):%~]$\
# set window title to current working directory
precmd() {
echo -ne "\033]0;$PWD\007"
}
################################################################
# debugging
################################################################
# Log extra info when working on config files.
export DOTFILES_DEBUG=false
function LOG_DEBUG {
if $DOTFILES_DEBUG; then;
echo $1 > /dev/stderr
fi;
}
################################################################
# iTerm2 keybindings
################################################################
# Configure option-arrow keys in iTerm 2
bindkey '[C' forward-word
bindkey '[D' backward-word
################################################################
# oh-my-zsh (deprecated)
################################################################
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
ZSH_THEME='serenity'
# Comment this out to disable weekly auto-update checks
DISABLE_AUTO_UPDATE="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)
plugins=(brew git osx virtualenv virtualenvwrapper)
################################################################
# environment variables
################################################################
export GIT_NAME="Ellen Teapot"
export GIT_EMAIL="hi@asmallteapot.com"
export GIT_PGPKEY="FC5DF75B8BBDB3C8"
export EDITOR="vim -f"
export PROJECTS="$HOME/Projects"
export TERM="xterm-256color"
# manage path as a zsh array
# http://superuser.com/a/598924
# setting the type of $path to -U deduplicates entries
typeset -U path
path=(
/usr/local/bin
/usr/local/sbin
$HOME/.bin
$HOME/.cargo/bin
$path
)
################################################################
# load other configuration files
################################################################
# sources files if they exist; otherwise, logs a warning if DEBUG=true
function source_if_exists {
LOG_DEBUG "source_if_exists - invoked with $1"
for file in $1; {
LOG_DEBUG "source_if_exists - checking $file"
if [[ -s $file ]]; then;
LOG_DEBUG "source_if_exists - sourcing $file"
source $file;
else
LOG_DEBUG "source_if_exists - can't source $file" > /dev/stderr
fi
}
}
unsetopt auto_name_dirs
source_if_exists $ZSH/oh-my-zsh.sh
source_if_exists ~/.zsh-alias
source_if_exists ~/.zsh/local/$(hostname -s).sh
################################################################
# python
################################################################
# auto-detect PYTHONPATH when installed via homebrew
if [[ -x brew ]]; then;
BREW_PREFIX=`brew --prefix`
PYTHON_VERSION=`python -c "import sys; print str(sys.version_info.major) + '.' + str(sys.version_info.minor)"`
export PYTHONPATH="$BREW_PREFIX/lib/python$PYTHON_VERSION/site-packages"
else;
# if we don't have homebrew, try asking the default python for its site-packages directory
export PYTHONPATH=`python -c "import site; print site.getsitepackages()[0]"`
fi;
# load virtualenvwrapper
export VIRTUAL_ENV_DISABLE_PROMPT=true
export VIRTUALENV_USE_DISTRIBUTE="True"
export WORKON_HOME=~/.virtualenv
source_if_exists "/usr/local/share/python/virtualenvwrapper.sh"
################################################################
# shell plugins
################################################################
# load git autocomplete
source_if_exists "/usr/local/share/zsh/site-functions"
# load zsh-syntax-highlighting
source_if_exists ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# load powerline
source_if_exists $PYTHONPATH/powerline/bindings/zsh/powerline.zsh
# load rbenv shims
if [[ -x rbenv ]]; then;
rbenv init -
fi;
# load swiftenv
if which swiftenv > /dev/null; then eval "$(swiftenv init -)"; fi
# load xcenv
if which xcenv > /dev/null; then eval "$(xcenv init -)"; fi
export XCENV_DO_NOT_SHIM_LIST="git"
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
eval $(gpg-agent --daemon --write-env-file ~/.gnupg/.gpg-agent-info)
fi