-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
executable file
·226 lines (183 loc) · 7.42 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
#######################################################################
# OH-MY-ZSH SETTINGS #
#######################################################################
# Path to oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
ZSH_THEME="sorin"
# disable auto-setting terminal title.
DISABLE_AUTO_TITLE="true"
# display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Which plugins to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(git brew pip zsh-autosuggestions zsh-syntax-highlighting colored-man-pages)
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Use Vi mode at command line
# bindkey -v
#######################################################################
# ENVIRONMENT VARIABLES #
#######################################################################
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin"
export LANG=en_US.UTF-8
# Reduce lag when switching between command and edit mode in vim
export KEYTIMEOUT=1
# for use with pylint via vim's syntastic plugin
export LC_CTYPE=en_US.UTF-8
# set lscolor scheme for black background
# info: http://softwaregravy.wordpress.com/2010/10/16/ls-colors-for-mac/
export CLICOLOR=1
export LSCOLORS=fxBxhxDxfxhxhxhxhxcxcx
# export GHCI=stack ghci
source $ZSH/oh-my-zsh.sh
#######################################################################
# ALIASES #
#######################################################################
# All machine-agnostic aliases should be defined in zshrc. Add all
# machine-specific aliases to ~/.aliases
# Add local ~/.aliases if defined
if [[ -a "${HOME}/.aliases" ]]; then
. "${HOME}/.aliases";
fi
# Set personal aliases (machine-specific aliases are sourced from ~/.aliases above)
# For a full list of active aliases, run `alias`.
alias zshrc="vim ~/.zshrc"
alias vimrc="vim ~/.vimrc"
alias screenrc="vim ~/.screenrc"
alias tmuxrc="vim ~/.tmux.conf"
alias bashrc="vim ~/.bashrc"
alias cp='cp -iv' # Preferred 'cp' implementation (interactive)
alias mv='mv -iv' # Preferred 'mv' implementation (interactive)
alias rm='rm -i' # Preferred 'rm' implementation (interactive)
alias ln='ln -i' # Preferred 'ln' implementation (interactive)
alias ls='ls -lhaG' # Colorize 'ls' output
alias qfind="find . -name " # qfind: Quickly search for file by name
alias h="cd ~" # ~: Go Home
alias cd..='cd ../' # Go up 1 directory level
alias ..='cd ../' # Go up 1 directory level
alias ...='cd ../../' # Go up 2 directory levels
alias .3='cd ../../../' # Go up 3 directory levels
alias .4='cd ../../../../' # Go up 4 directory levels
alias .5='cd ../../../../../' # Go up 5 directory levels
alias .6='cd ../../../../../../' # Go up 6 directory levels
#######################################################################
# CUSTOM COMMANDS #
#######################################################################
# for ctrl-z in vim to toggle between shell and vim session
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
BUFFER="fg"
zle accept-line
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
powerline-daemon -q
# extract: Extract most known archives with one command
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
# defaults for the fuzzyfinder fzf command
_gen_fzf_default_opts() {
local base03="234"
local base02="235"
local base01="240"
local base00="241"
local base0="244"
local base1="245"
local base2="254"
local base3="230"
local yellow="136"
local orange="166"
local red="160"
local magenta="125"
local violet="61"
local blue="33"
local cyan="37"
local green="64"
local white="15"
# Solarized Dark color scheme for fzf
export FZF_DEFAULT_OPTS="
--color fg:-1,bg:-1,hl:$orange,fg+:$base2,bg+:$base03,hl+:$orange
--color info:$yellow,prompt:$yellow,pointer:$yellow,marker:$yellow,spinner:$white
--height 40% --border
"
# alternate Solarized colors
# export FZF_DEFAULT_OPTS='
# --color dark,hl:33,hl+:37,fg+:235,bg+:136,fg+:254
# --color info:254,prompt:37,spinner:108,pointer:235,marker:235
# --height 40% --border
# '
}
_gen_fzf_default_opts
#######################################################################
# ADDITIONAL IMPORTS #
#######################################################################
# Load RVM into a shell session *as a function*
if [[ -a "$HOME/.rvm/scripts/rvm" ]]; then
. "$HOME/.rvm/scripts/rvm";
fi
# source Haskell / Tidal environment
if [[ -a "${HOME}/.ghcup/env" ]]; then
. $HOME/.ghcup/env;
fi
# initialize shell integration if using iterm2
if [[ -a "${HOME}/.iterm2_shell_integration.zsh" ]]; then
. "${HOME}/.iterm2_shell_integration.zsh";
fi
# tabtab source for electron-forge package
# uninstall by removing these lines or running `tabtab uninstall electron-forge`
if [[ -a "/usr/local/lib/node_modules/electron-forge/node_modules/tabtab/.completions/electron-forge.zsh" ]]; then
. "/usr/local/lib/node_modules/electron-forge/node_modules/tabtab/.completions/electron-forge.zsh";
fi
# update PATH for the Google Cloud SDK.
if [[ -a "${HOME}/google-cloud-sdk/path.zsh.inc" ]]; then
. "${HOME}/google-cloud-sdk/path.zsh.inc";
fi
# enable shell command completion for gcloud.
if [[ -a "${HOME}/google-cloud-sdk/completion.zsh.inc" ]]; then
. "${HOME}/google-cloud-sdk/completion.zsh.inc";
fi
# initialize the fzf searcher
if [[ -a "${HOME}/.fzf.zsh" ]]; then
. "${HOME}/.fzf.zsh";
fi
# https://stackoverflow.com/questions/50168647/multiprocessing-causes-python-to-crash-and-gives-an-error-may-have-been-in-progr
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# Adjust the session-wide environment for your account.
eval "$(pyenv init --path)"
# Enable autocompletion and all subcommands
eval "$(pyenv init -)"
# enable auto-activation of virtualenvs
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi