-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
executable file
·214 lines (171 loc) · 7.11 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
# zmodload zsh/zprof
# Path to your oh-my-zsh installation.
POWERLEVEL9K_MODE='nerdfont-complete'
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir docker_machine vcs)
POWERLEVEL9K_VI_INSERT_MODE_STRING=''
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status root_indicator background_jobs ram vi_mode)
POWERLEVEL9K_VCS_GIT_HOOKS=(vcs-detect-changes git-untracked git-aheadbehind git-remotebranch git-tagname)
export ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
# ZSH_THEME="robbyrussell"
ZSH_THEME="powerlevel9k/powerlevel9k"
# ZSH_THEME=agnoster
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# 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 disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to disable command auto-correction.
# DISABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# 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 if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(vi-mode github docker tmux git rails rake ruby brew bundler coffee colored-man-pages colorize gem heroku node npm osx nvm zsh-autosuggestions fasd jira yarn)
source $ZSH/oh-my-zsh.sh
# vim_ins_mode="%{$fg[cyan]%}[INS]%{$reset_color%}"
# vim_cmd_mode="%{$fg[green]%}[CMD]%{$reset_color%}"
# vim_mode=$vim_ins_mode
# User configuration
export PATH="~/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:$HOME/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/sbin"
# export PATH="$PATH:`yarn global bin`"
export PATH="$PATH:$HOME/.config/yarn/global/node_modules/.bin"
export PATH="$PATH:/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/bin"
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# ssh
# export SSH_KEY_PATH="~/.ssh/dsa_id"
export KEYTIMEOUT=1
#use vim mode in terminal
# bindkey -v
bindkey "^[[5~" history-beginning-search-backward
bindkey "^[[6~" history-beginning-search-forward
# bindkey '[C' forward-word
# bindkey '[D' backward-word
export MYNVIMRC=~/.config/nvim/init.vim
alias v="nvim"
hp() { heroku "$*" -a wiseview; }
hs() { heroku "$*" -a wiseview-staging; }
if command -v grunt>/dev/null; then
eval "$(grunt --completion=zsh)"
fi
eval "$(rbenv init - rvm)"
# export NVM_DIR=~/.nvm
# source $(brew --prefix nvm)/nvm.sh
alias fs="cd $HOME/forks/nervecenter && npm start"
alias fv="cd $HOME/forks/nervecenter && v"
alias ns="cd $HOME/nervecenter && npm start"
alias nv="cd $HOME/nervecenter && v"
# alias git to hub
# eval "$(hub alias -s)"
dark() {
sed -i.bak -e s/background=light/background=dark/ ~/.config/nvim/init.vim
sed -i.back -e s/^ZSH_THEME=agnoster-light$/ZSH_THEME=agnoster/ ~/.zshrc
export ZSH_THEME=agnoster
echo "\033Ptmux;\033\033]1337;SetProfile=Default\a\033\\"
tmux source-file ~/.tmuxstatus.conf
}
light() {
sed -i.bak -e s/background=dark/background=light/ ~/.config/nvim/init.vim
sed -i.back -e s/^ZSH_THEME=agnoster$/ZSH_THEME=agnoster-light/ ~/.zshrc
# export ZSH_THEME=agnoster-light
export POWERLEVEL9K_COLOR_SCHEME='light'
echo "\033Ptmux;\033\033]1337;SetProfile=Default light\a\033\\"
tmux source-file ~/.tmuxstatuslight.conf
}
eval "$(thefuck --alias)"
# alias dmr="docker-machine restart dev && sleep 1 && eval \"$(docker-machine env dev)\""
alias dcd="docker-compose -f docker-compose.yml -f docker-compose.dev.yml"
alias dcdb="docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm web /bin/bash"
alias dct="docker-compose -f docker-compose.yml -f docker-compose.dev.yml"
alias dcdt="docker-compose -f docker-compose.yml -f docker-compose.dev.yml run --rm -e "RAILS_ENV=test" pocketchange bash"
alias dsd="docker-compose -f docker-compose.yml -f docker-compose.sandbox.yml"
alias dcc="docker-compose"
alias db="pgcli -h localhost -U postgres"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
export FZF_DEFAULT_COMMAND='ag -g ""'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
# fbr - # Fuzzy search over git branches ordered by recency
fbr () {
git checkout $(git for-each-ref --sort=-committerdate refs/heads/ | awk '{print $3}' | cut -c $(echo " refs/head/" | wc -c)- | fzf-tmux)
}
# fco - checkout git branch/tag
fco() {
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 -l30 -- --no-hscroll --ansi +m -d "\t" -n 2) || return
git checkout $(echo "$target" | awk '{print $2}')
}
alias gt="tig"
# alias npm="echo \"⚠️ use yarn\""
# fstash - easier way to deal with stashes
# type fstash to get a list of your stashes
# enter shows you the contents of the stash
# ctrl-d shows a diff of the stash against your current HEAD
# ctrl-b checks the stash out as a branch, for easier merging
fstash() {
local out q k sha
while out=$(
git stash list --pretty="%C(yellow)%h %>(14)%Cgreen%cr %C(blue)%gs" |
fzf --ansi --no-sort --query="$q" --print-query \
--expect=ctrl-d,ctrl-b);
do
mapfile -t out <<< "$out"
q="${out[0]}"
k="${out[1]}"
sha="${out[-1]}"
sha="${sha%% *}"
[[ -z "$sha" ]] && continue
if [[ "$k" == 'ctrl-d' ]]; then
git diff $sha
elif [[ "$k" == 'ctrl-b' ]]; then
break;
else
git stash show -p $sha
fi
done
}
# Add syntax hightlighting
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
export TERM=xterm-256color
export TMUX_PLUGIN_MANAGER_PATH=~/.tmux/plugins
# zprof