forked from aaronlake/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
176 lines (152 loc) · 4.52 KB
/
Copy pathzshrc
File metadata and controls
176 lines (152 loc) · 4.52 KB
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
### OS Detection
UNAME=`uname`
# Fallback info
CURRENT_OS='Linux'
DISTRO=''
if [[ $UNAME == 'Darwin' ]]; then
CURRENT_OS='OS X'
else
# Must be Linux, determine distro
if [[ -f /etc/redhat-release ]]; then
# CentOS or Redhat?
if grep -q "CentOS" /etc/redhat-release; then
DISTRO='CentOS'
else
DISTRO='RHEL'
fi
fi
fi
# PATH Settings
GOPATH=$HOME/go/bin
PATH=$HOME/bin:$PATH:/usr/local/opt/go/libexec/bin:$GOPATH
### Antibody Configuration
# Load Antibody
source <(antibody init)
ZSH="$(antibody home)/https-COLON--SLASH--SLASH-github.com-SLASH-robbyrussell-SLASH-oh-my-zsh"
antibody bundle < ~/.dotfiles/zsh_plugins.txt
# OS specific plugins
if [[ $CURRENT_OS == 'OS X' ]]; then
antibody bundle < ~/.dotfiles/zsh_plugins_osx.txt
PATH="$(brew --prefix coreutils)/libexec/gnubin:$PATH"
elif [[ $CURRENT_OS == 'Linux' ]]; then
if [[ $DISTRO == 'CentOS' ]]; then
antibody bundle centos
fi
elif [[ $CURRENT_OS == 'Cygwin' ]]; then
antibody bundle cygwin
fi
DISABLE_AUTO_UPDATE=true
# Powerline Go
function powerline_precmd() {
PS1="$(powerline-go -error $? -shell zsh -modules "venv,user,host,ssh,node,docker,kube,aws,cwd,perms,git,hg,jobs,exit,root")"
}
function install_powerline_precmd() {
for s in "${precmd_functions[@]}"; do
if [ "$s" = "powerline_precmd" ]; then
return
fi
done
precmd_functions+=(powerline_precmd)
}
if [ "$TERM" != "linux" ]; then
install_powerline_precmd
fi
# Ensure languages are set
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# Exports & Functions
source ~/.dotfiles/exports
source ~/.dotfiles/functions
# Command line helpers
if [[ -d "/usr/local/share/zsh-completions" ]]; then
fpath=(/usr/local/share/zsh-completions $fpath)
fi
# http://vim.wikia.com/wiki/256_colors_in_vim
if [ "$TERM" = "xterm" ] ; then
if [ -z "$COLORTERM" ] ; then
if [ -z "$XTERM_VERSION" ] ; then
echo "Warning: Terminal wrongly calling itself 'xterm'."
else
case "$XTERM_VERSION" in
"XTerm(256)") TERM="xterm-256color" ;;
"XTerm(88)") TERM="xterm-88color" ;;
"XTerm") ;;
*)
echo "Warning: Unrecognized XTERM_VERSION: $XTERM_VERSION"
;;
esac
fi
else
case "$COLORTERM" in
gnome-terminal)
# Those crafty Gnome folks require you to check COLORTERM,
# but don't allow you to just *favor* the setting over TERM.
# Instead you need to compare it and perform some guesses
# based upon the value. This is, perhaps, too simplistic.
TERM="gnome-256color"
;;
*)
echo "Warning: Unrecognized COLORTERM: $COLORTERM"
;;
esac
fi
fi
SCREEN_COLORS="`tput colors`"
if [ -z "$SCREEN_COLORS" ] ; then
case "$TERM" in
screen-*color-bce)
echo "Unknown terminal $TERM. Falling back to 'screen-bce'."
export TERM=screen-bce
;;
*-88color)
echo "Unknown terminal $TERM. Falling back to 'xterm-88color'."
export TERM=xterm-88color
;;
*-256color)
echo "Unknown terminal $TERM. Falling back to 'xterm-256color'."
export TERM=xterm-256color
;;
esac
SCREEN_COLORS=`tput colors`
fi
if [ -z "$SCREEN_COLORS" ] ; then
case "$TERM" in
gnome*|xterm*|konsole*|aterm|[Ee]term)
echo "Unknown terminal $TERM. Falling back to 'xterm'."
export TERM=xterm
;;
rxvt*)
echo "Unknown terminal $TERM. Falling back to 'rxvt'."
export TERM=rxvt
;;
screen*)
echo "Unknown terminal $TERM. Falling back to 'screen'."
export TERM=screen
;;
esac
SCREEN_COLORS=`tput colors`
fi
alias tmux='tmux -2'
if [[ -a /usr/local/bin/lsd ]] ; then
alias ls='lsd'
alias ll='ls -l'
alias l='ls -la'
elif [[ -a /usr/local/bin/gls ]] ; then
alias ls='gls --color=always'
fi
# https://github.com/nvbn/thefuck
alias fuck='$(thefuck $(fc -ln -1))'
# Initialize anyenv
if [ -d $HOME/.anyenv ] ; then
export PATH=$HOME/.anyenv/bin:$PATH
eval "$(anyenv init - zsh)"
for D in `ls $HOME/.anyenv/envs`
do
export PATH="$HOME/.anyenv/envs/$D/shims:$PATH"
done
fi
# history management
setopt inc_append_history
setopt share_history
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'