-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc.symlink
181 lines (150 loc) · 5.5 KB
/
zshrc.symlink
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
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_CUSTOM=~/.oh-my-zsh-custom
ZSH_THEME="mziwisky"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="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"
# show timestamps in `history` output
HIST_STAMPS="yyyy-mm-dd"
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
# NOTES:
# - in general, order matters here
# - zsh-syntax-highlighting needs to be last in the list
# - fzf-tab needs to be before it but after probably everything else (see
# fzf-tab docs for details)
# - aws gives me completion for awscli
plugins=(aws fzf-tab zsh-syntax-highlighting)
# see: https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
if type brew &>/dev/null; then
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
autoload -Uz compinit
compinit
fi
source $ZSH/oh-my-zsh.sh
# All the above is oh-my-zsh stuff, comes from the OMZ zshrc template.
# Now on to the stuff that's (mostly) OMZ-agnostic.
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory
setopt hist_find_no_dups
bindkey -v
# End of lines configured by zsh-newuser-install
# stupid oh-my-zsh wants to fuck with pushd...
unsetopt pushdminus
unsetopt pushdignoredups
unsetopt autopushd
# also, keep histories separate
unsetopt sharehistory
# all this nonsense makes it so that when you type something and then press the
# up and down arrow keys, you cycle through your history of commands that start
# with whatever you just typed.
autoload -U history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey $terminfo[kcuu1] history-beginning-search-backward-end
bindkey $terminfo[kcud1] history-beginning-search-forward-end
# reverse intelligent search -- super handy!
bindkey "^R" history-incremental-search-backward
export EDITOR=vim
alias ls='ls -G'
alias l='ls -Fa'
alias ll='ls -la'
alias lll='ls -alotr' # sort by mod time, most recent last
alias llll='ls -aloSrh' # sort by size, largest last
alias cp='cp -v -i'
alias rm='rm -i'
alias mv='mv -v -i'
alias vdiff=opendiff
alias grep='grep --color=auto'
alias ngrok-host='ngrok http -host-header=rewrite'
alias dc='docker-compose'
alias dcr='docker-compose run --rm'
alias g='git'
alias gca='git commit -av'
alias gcaa='git commit -av --amend'
alias gco='git checkout'
alias gcp='git cherry-pick'
alias gd='git diff'
alias gg='git graph'
alias gp='git pull'
alias gpr='gh pr create --fill'
alias gs='git status'
alias gsh='git show'
alias tf='terraform'
alias tg='terragrunt'
alias bx='bundle exec'
alias pyserv='python3 -m http.server 8000'
alias b64='base64'
# git cherry-pick to main
function gcptm() {
local main_branch=$(git branch -lr | grep -q origin/main && echo main || echo master)
local branch=$(git branch --show-current)
local sha=$(git rev-parse --short HEAD)
[[ -n $(git status --porcelain) ]] && echo "branch is dirty, clean up before cherry picking" && return 1
[[ $branch == $main_branch ]] && echo "you're already on $main_branch" && return 1
echo "cherry-picking $branch onto latest $main_branch (leaving behind $sha)"
local PS4='=> '
set -x
git fetch origin $main_branch || return $?
git checkout origin/$main_branch || return $?
git cherry-pick $branch || return $?
git checkout -B $branch || return $?
}
# purge old docker images (interactively)
function docker-gc() {
docker images -f "dangling=true"
read -k 1 "yn?You cool deleting all those? [y/n] "
echo ""
case $yn in
[Nn]* ) return;;
esac
docker images -f "dangling=true" -q | while read ID; do docker rmi $ID; done;
}
function mkcd() {
mkdir -p $1 && cd $1
}
if [ -n "$ZSH_THEME" ]; then
# oh-my-zsh is probably being used
else
# probably no oh-my-zsh, so set your PS1
PS1="%F{green}[%n@%m %F{red}%1~%F{green}]%(#.#.$)%f "
echo "You should probably get oh-my-zsh, n00b."
fi
# if `starship` is installed, use that for my prompt. installation instructions
# at https://github.com/starship/starship
if command -v starship &> /dev/null; then
eval "$(starship init zsh)"
fi
# asdf, the swiss army knife of version managers
if [ -e /opt/homebrew/opt/asdf/libexec/asdf.sh ]; then
source /opt/homebrew/opt/asdf/libexec/asdf.sh
fi
function prof() {
if command -v fzf &> /dev/null; then
export AWS_PROFILE=$(aws configure list-profiles | fzf +s --tac)
else
echo 'HINT: install `fzf` for a nicer interface'
export AWS_PROFILE=$(select v in `aws configure list-profiles`; do echo $v; break; done)
fi
}
# i know, env exports should go in .zprofile, but i'm just blindly following the pyenv setup guide right now
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"