-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathzshenv
410 lines (346 loc) · 11.3 KB
/
zshenv
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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin"
# source ~/.keys
# export MACOSX_DEPLOYMENT_TARGET=10.14
export KEYTIMEOUT=1
export CLICOLOR=1
export EDITOR=nvim
export _Z_DATA="$HOME/z-data"
export ITERM_24BIT=1
export DISABLE_AUTO_TITLE="true"
# export TERM="xterm-updated"
# Load rbenv automatically by appending
# the following to ~/.zshrc:
# export PATH="$HOME/.rbenv/bin:$PATH"
# export PATH="$HOME/.rbenv/shims:$PATH"
export PATH=/usr/local/bin:$PATH
export PATH=${PATH}:~/bin
# export BREW_PATH=$(brew --prefix)
export PATH=${PATH}:~/bin/nvim/bin
# Python...amiright
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
# Java setup
export GRADLE_HOME=$BREW_PATH
# export ANDROID_NDK_HOME="/usr/local/share/android-ndk"
# export ANDROID_HOME=/usr/local/share/android-sdk
# export PATH=$PATH:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/emulator
# new android setup?
export ANDROID_SDK_ROOT=~/Library/Android/sdk
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/platform-tools/:$ANDROID_HOME/emulator
export PATH=$ANDROID_HOME:$PATH
export AVD=/usr/local/bin/avdmanager
export PATH=$AVD:$PATH
export SDK_MANAGER=/usr/local/bin/sdkmanager
export PATH=$SDK_MANAGER:$PATH
export ADB=/usr/local/bin/adb
export PATH=$ADB:$PATH
# export PATH=$ANDROID_NDK:$PATH
export PATH=$PATH:$GRADLE_HOME/bin
export PATH=$JAVA_HOME/bin:$PATH
# This is for android crap
# I dont know if I can delete this stuff yet.
# export PATH="/usr/local/opt/openjdk/bin:$PATH"
# export PATH=${PATH}:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools
# export PATH=${PATH}:$ANDROID_HOME/tools/bin/avdmanager:$ANDROID_HOME/tools/bin/sdkmanager
# export PATH=$ANDROID_HOME/emulator:$PATH
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/opt/python@2/bin:$PATH"
# export PATH="$(brew --prefix gettext)/bin:$PATH"
# export CFLAGS="-I/usr/local/opt/openssl/include $CFLAGS"
# export LDFLAGS="-L/usr/local/opt/openssl/lib $LDFLAGS"
# export LDFLAGS="-Wl,-headerpad_max_install_names ${LDFLAGS}"
# Ruby
# export PATH="/usr/local/opt/ruby/bin:$PATH"
# export LDFLAGS="-L/usr/local/opt/ruby/lib"
# export CPPFLAGS="-I/usr/local/opt/ruby/include"
# export PKG_CONFIG_PATH="/usr/local/opt/ruby/lib/pkgconfig"
#
export RUST_SRC_PATH=$HOME/.cargo/bin
export PATH=$PATH:$RUST_SRC_PATH
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
# export PATH="/usr/local/opt/icu4c/bin:$PATH"
# export PATH="/usr/local/opt/icu4c/sbin:$PATH"
# export PATH="/usr/local/opt/texinfo/bin:$PATH"
export EVENT_NOKQUEUE=1
# eval "$(rbenv init - zsh)"
function strip_diff_leading_symbols(){
color_code_regex=$'(\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K])'
# simplify the unified patch diff header
sed -E "s/^($color_code_regex)diff --git .*$//g" | \
sed -E "s/^($color_code_regex)index .*$/\
\1$(rule)/g" | \
sed -E "s/^($color_code_regex)\+\+\+(.*)$/\1\+\+\+\5\\
\1$(rule)/g" | \
# actually strips the leading symbols
sed -E "s/^($color_code_regex)[\+\-]/\1 /g"
}
## Print a horizontal rule
rule () {
printf "%$(tput cols)s\n"|tr " " "─"
}
function code () {
VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $*
}
function zle-line-init zle-keymap-select {
VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]% %{$reset_color%}"
RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $(git_custom_status) $EPS1"
zle reset-prompt
}
# alias pip=/usr/local/bin/pip3
# alias python3=/usr/local/bin/python3
# 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
alias nvimInstall='make distclean && make deps && make && make CMAKE_BUILD_TYPE=Release CMAKE_INSTALL_PREFIX=$HOME/bin/nvim install'
# Some aliases for Homebrew
alias bup='brew update && brew upgrade'
alias bout='brew outdated'
alias bin='brew install'
alias brm='brew uninstall'
alias bls='brew list'
alias bsr='brew search'
alias binf='brew info'
alias bdr='brew doctor'
# Some directory listing with colors
alias sl=ls
# alias ls='ls -GpF' # Compact view, show colors
alias la='ls -GAF' # Compact view, show hidden
alias ll='ls -alGpF'
alias l='ls -a'
alias l1='ls -1'
# because I'm to lazy to write vim
alias v='nvim'
# alias n="nvim"
alias s="sudo"
# Desktop Programs
alias f='open -a Finder '
alias fh='open -a Finder .'
# Usefull stuff for presentation and seeing dotfiles
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
alias showall='defaults write com.apple.finder AppleShowAllFiles YES && killall Finder'
alias hideall='defaults write com.apple.finder AppleShowAllFiles NO && killall Finder'
# Get rid of those pesky .DS_Store files recursively
alias dsclean='find . -type f -name .DS_Store -print0 | xargs -0 rm'
# Flush your dns cache
alias flush='dscacheutil -flushcache'
alias luamake=/Users/mhartington/Github/lua-language-server/3rd/luamake/luamake
function symLink(){
echo "Creating symlinks"
cp -f dist/js/ionic.bundle.js tmp/www/lib/ionic/js/ionic.bundle.js
cp -f dist/css/ionic.css tmp/www/lib/ionic/css/ionic.css
echo "done"
}
# Because Typing python -m SimpleHTTPServer is too Damn Long
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
# open "http://localhost:${port}/"
open -a google\ chrome\ canary "http://localhost:${port}/" --args --disable-web-security
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
}
function download(){
curl -O "$1"
}
function highlight(){
highlight -O rtf $1 --font-size 25 --style solarized-dark -W -J 50 -j 3 --src-lang $2 | pbcopy
}
alias dl=download
function ghUpdate() {
if git remote | grep upstream > /dev/null; then
echo "upstream is set"
elif [ -z "$1" ]; then
read "?Whats the URl of the original repo? " answer
git remote add upstream $answer
else
git remote add upstream $1
fi
git fetch upstream
git checkout master
git rebase upstream/master
}
function ghPages(){
if [ -z "$1" ]
then
read "?Which folder do you want to deploy to GitHub Pages? " answer
git subtree push --prefix $answer origin gh-pages
else
git subtree push --prefix $1 origin gh-pages
fi
}
# incase i forget how to clear
alias c='clear'
alias k='clear'
alias cls='clear'
# presentation crap
# alias whoamireally='echo "Mike Hartington
# Dev Advocate for Ionic
# Beer lover and Cat lover" '
# archive file or folder
function compress() {
dirPriorToExe=`pwd`
dirName=`dirname $1`
baseName=`basename $1`
if [ -f $1 ] ; then
echo "It was a file change directory to $dirName"
cd $dirName
case $2 in
tar.bz2)
tar cjf $baseName.tar.bz2 $baseName
;;
tar.gz)
tar czf $baseName.tar.gz $baseName
;;
gz)
gzip $baseName
;;
tar)
tar -cvvf $baseName.tar $baseName
;;
zip)
zip -r $baseName.zip $baseName
;;
*)
echo "Method not passed compressing using tar.bz2"
tar cjf $baseName.tar.bz2 $baseName
;;
esac
echo "Back to Directory $dirPriorToExe"
cd $dirPriorToExe
else
if [ -d $1 ] ; then
echo "It was a Directory change directory to $dirName"
cd $dirName
case $2 in
tar.bz2)
tar cjf $baseName.tar.bz2 $baseName
;;
tar.gz)
tar czf $baseName.tar.gz $baseName
;;
gz)
gzip -r $baseName
;;
tar)
tar -cvvf $baseName.tar $baseName
;;
zip)
zip -r $baseName.zip $baseName
;;
*)
echo "Method not passed compressing using tar.bz2"
tar cjf $baseName.tar.bz2 $baseName
;;
esac
echo "Back to Directory $dirPriorToExe"
cd $dirPriorToExe
else
echo "'$1' is not a valid file/folder"
fi
fi
echo "Done"
echo "###########################################"
}
# Extract archives - use: extract <file>
# Based on http://dotfiles.org/~pseup/.bashrc
function extract() {
local remove_archive
local success
local file_name
local extract_dir
if (( $# == 0 )); then
echo "Usage: extract [-option] [file ...]"
echo
echo Options:
echo " -r, --remove Remove archive."
fi
remove_archive=1
if [[ "$1" == "-r" ]] || [[ "$1" == "--remove" ]]; then
remove_archive=0
shift
fi
while (( $# > 0 )); do
if [[ ! -f "$1" ]]; then
echo "extract: '$1' is not a valid file" 1>&2
shift
continue
fi
success=0
file_name="$( basename "$1" )"
extract_dir="$( echo "$file_name" | sed "s/\.${1##*.}//g" )"
case "$1" in
(*.tar.gz|*.tgz) [ -z $commands[pigz] ] && tar zxvf "$1" || pigz -dc "$1" | tar xv ;;
(*.tar.bz2|*.tbz|*.tbz2) tar xvjf "$1" ;;
(*.tar.xz|*.txz) tar --xz --help &> /dev/null \
&& tar --xz -xvf "$1" \
|| xzcat "$1" | tar xvf - ;;
(*.tar.zma|*.tlz) tar --lzma --help &> /dev/null \
&& tar --lzma -xvf "$1" \
|| lzcat "$1" | tar xvf - ;;
(*.tar) tar xvf "$1" ;;
(*.gz) [ -z $commands[pigz] ] && gunzip "$1" || pigz -d "$1" ;;
(*.bz2) bunzip2 "$1" ;;
(*.xz) unxz "$1" ;;
(*.lzma) unlzma "$1" ;;
(*.Z) uncompress "$1" ;;
(*.zip|*.war|*.jar|*.sublime-package) unzip "$1" -d $extract_dir ;;
(*.rar) unrar x -ad "$1" ;;
(*.7z) 7za x "$1" ;;
(*.deb)
mkdir -p "$extract_dir/control"
mkdir -p "$extract_dir/data"
cd "$extract_dir"; ar vx "../${1}" > /dev/null
cd control; tar xzvf ../control.tar.gz
cd ../data; tar xzvf ../data.tar.gz
cd ..; rm *.tar.gz debian-binary
cd ..
;;
(*)
echo "extract: '$1' cannot be extracted" 1>&2
success=1
;;
esac
(( success = $success > 0 ? $success : $? ))
(( $success == 0 )) && (( $remove_archive == 0 )) && rm "$1"
shift
done
}
alias x=extract
function gif(){
ffmpeg -i $1 -vf scale=$2:-1:flags=lanczos -f gif - | gifsicle --optimize=3 --delay=3 > $3
}
function fixAudio(){
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' | awk '{print $1}'`
}
function fixGpg(){
gpgconf --kill gpg-agent
}
# function fixSSH(){
# eval $(ssh-agent);
# ssh-add ~/.ssh/id_rsa
# }
function ghPatch () {
curl -L $1.patch | git am
}
# if [[ "$(uname -s)" == "Darwin" ]]; then
# fi
# killport() { lsof -i tcp:$1 | awk 'NR!=1 {print $2}' | xargs kill }
# function changeMac(){
# local mac=$(openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//')
# sudo ifconfig en0 ether $mac
# sudo ifconfig en0 down
# sudo ifconfig en0 up
# echo "Your new physical address is $mac"
# }
#
function cleanModules() {
for i in $(find . -name node_modules -type d); do
rm -r $i
done
}