-
Notifications
You must be signed in to change notification settings - Fork 1
/
zshrc
125 lines (101 loc) · 3.8 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
# alias all the things
alias desk="cd ~/Desktop"
alias start_postgres="pg_ctl -D /usr/local/var/postgres9 -l /usr/local/var/postgres9/server.log start"
alias stop_postgres=" pg_ctl -D /usr/local/var/postgres9 stop -s -m fast"
alias bake="bundle exec rake"
alias gg="git grep --color -n $1"
alias gch="git checkout $1"
alias gpr="git pull --rebase"
alias gpoh="git push origin HEAD"
alias heroku_restore="pg_restore --verbose --clean --no-acl --no-owner"
alias git_local_cleanup="git branch --merged | grep -v \"\*\" | xargs -n 1 git branch -d"
alias emacs="TERM=xterm-256color emacs"
alias vim="TERM=screen-256color nvim"
alias nnvim="TERM=screen-256color ~/Code/nvim-osx64/bin/nvim"
alias ns="nix-shell --run zsh"
alias pn="note-search ~/Dropbox/Notes/Personal/"
alias wn="note-search ~/Dropbox/Notes/Work/"
alias wpn="note-search ~/Dropbox/Notes/Work-Private/"
function track() {
branch_name=$(git branch | grep "*");
branch_name="${branch_name/\* /}";
git branch --set-upstream-to=origin/$branch_name $branch_name;
}
# fuzzy git branch checkout with fzf
gco() {
local tags branches target
tags=$(
git tag | awk '{print "\x1b[31;1mtag\x1b[m\t" $1}') || return
branches=$(
git branch --all | grep -v HEAD |
sed "s/.* //" | sed "s#remotes/[^/]*/##" |
sort -u | awk '{print "\x1b[34;1mbranch\x1b[m\t" $1}') || return
target=$(
(echo "$tags"; echo "$branches") |
fzf-tmux -d50 -- --no-hscroll --ansi +m -d "\t" -n 2) || return
git checkout $(echo "$target" | awk '{print $2}')
}
# general environment variable setup
export EDITOR=vim
export GIT_EDITOR=nvim
export PATH=~/dot-files/bin/:~/.bin:./bin:/usr/local/bin:./node_modules/.bin/:$PATH
# tmuxinator setup
[[ -s $HOME/.tmuxinator/scripts/tmuxinator ]] && source $HOME/.tmuxinator/scripts/tmuxinator
# Ruby performance tweaks
export RUBY_GC_HEAP_INIT_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000
# Go source path
export GOPATH=$HOME/Code/go
export PATH=~/.bin/:$PATH:$GOPATH/bin
# disable zsh autocorrect
unsetopt correct_all
unsetopt correct
export NODE_PATH=/usr/local/lib/node_modules
export COLORTERM=xterm
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Setting ag as the default source for fzf
# So that fzf (w/o pipe) will use ag instead
# of find, respecting .gitignore
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export BBWORKSPACE="/Users/thomasmayfield/Code"
if [[ -x "$(command -v git)" && -x "$(command -v dinghy)" ]]; then
eval $(dinghy env)
fi
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi
setopt NO_AUTOLIST BASH_AUTOLIST NO_MENUCOMPLETE
# Add aws bin to path
export PATH=~/Library/Python/3.7/bin:$PATH
# slightly less eyestraining ls colors
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
export LS_COLORS=$LSCOLORS
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export PATH="$PATH:$HOME/.rbenv/bin"
eval "$(rbenv init -)"
export PATH="$PATH:/opt/homebrew/bin/"
# wrapper for aws-vault
# usage: awsv ROLE AWSCLI-COMMAND AWSCLI-ARGS
# e.g. `awsv ro s3 ls s3://foobucket`
function awsv () {
local role="$1"
shift
aws-vault exec "$role" -- aws "$@"
}
alias aws="aws-vault exec ro -- aws"
alias aws-rw="aws-vault exec rw -- aws"
alias aws-superadmin="aws-vault exec superadmin -- aws"
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/tools
export PATH=$PATH:$ANDROID_HOME/tools/bin
export PATH=$PATH:$ANDROID_HOME/platform-tools
[ -f ~/.secrets.zsh ] && source ~/.secrets.zsh
export FASTLANE_HIDE_CHANGELOG=true
eval "$(mise activate)"
export PATH=$PATH:/Users/thomasmayfield/bb-dot-files/bin/