/
.zshrc
219 lines (181 loc) · 5.08 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
export CLICOLOR=1
export EDITOR=vim
HISTIGNORE="&:ls:[bf]g:exit:reset:clear:cd:cd ..:cd.."
HISTSIZE=10000 # zsh
SAVEHIST=10000 # zsh
setopt SHARE_HISTORY # Share command history with other Zsh sessions
setopt HIST_IGNORE_ALL_DUPS # Don't save duplicate entries in history
setopt HIST_IGNORE_SPACE # Don't save commands starting with a space
setopt INTERACTIVE_COMMENTS # Allow use of comments in interactive code
setopt NO_FLOW_CONTROL # Disable flow control using Ctrl-S and Ctrl-Q
setopt EMACS # Explicitly set Emacs-style line editing (fix VS Code)
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' # zsh: case-insensitive completion style
zstyle :prompt:pure:git:stash show yes # pure: turn on git stash status
ZAP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/zap"
[ -f "${ZAP_DIR}/zap.zsh" ] || git clone -b release-v1 https://github.com/zap-zsh/zap.git "${ZAP_DIR}"
source "${ZAP_DIR}/zap.zsh"
plug "mafredri/zsh-async"
plug "sindresorhus/pure"
plug "aluxian/zsh-async-disable-npm-fund"
plug "aluxian/zsh-async-disable-npm-update-notifier"
plug "aluxian/zsh-sponge"
plug "aluxian/zsh-retry"
plug "aluxian/zsh-trash"
plug "aluxian/zsh-hushlogin"
plug "aluxian/zsh-ctrl-x-e"
plug "aluxian/zsh-ctrl-t"
plug "aluxian/zsh-app-cleaner"
plug "aluxian/zsh-pet"
plug "aluxian/zsh-gpt"
plug "Aloxaf/fzf-tab"
plug "zsh-users/zsh-completions"
plug "zsh-users/zsh-autosuggestions"
plug "zsh-users/zsh-syntax-highlighting"
autoload -Uz compinit
compinit
# .vimrc
if [ ! -f ~/.vimrc ]; then
cat << 'EOF' > ~/.vimrc
" DO NOT MODIFY
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'airblade/vim-gitgutter'
Plug 'itchyny/lightline.vim'
Plug 'junegunn/fzf.vim'
Plug 'dag/vim-fish'
Plug 'mhinz/vim-startify'
Plug 'morhetz/gruvbox'
Plug 'prettier/vim-prettier'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-dadbod'
Plug 'godlygeek/tabular'
Plug 'preservim/vim-markdown'
call plug#end()
set nocompatible
filetype plugin on
filetype indent on
syntax on
colorscheme gruvbox
set rtp+=/usr/local/opt/fzf
set ignorecase
set smartcase
set lazyredraw
set clipboard=unnamed
set autoread
set autoindent
set backspace=indent,eol,start
set complete-=i
set number
set ruler
set updatetime=500
set laststatus=2
set exrc
set secure
set background=dark
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:gruvbox_bold = 1
let g:gruvbox_italic = 1
let g:gruvbox_underline = 1
let g:gruvbox_undercurl = 1
let g:gruvbox_termcolors = 256
let g:gruvbox_improved_strings = 1
let g:gruvbox_improved_warnings = 1
let g:gruvbox_contrast_dark = 'hard'
let g:gruvbox_contrast_light = 'hard'
let g:lightline = {'colorscheme': 'gruvbox'}
EOF
echo ".vimrc created"
fi
# .zprofile
if [ ! -f ~/.zprofile ]; then
cat << 'EOF' > ~/.zprofile
# DO NOT MODIFY
# pipx
export PATH="$HOME/.local/bin:$PATH"
# Go
export PATH="$GOBIN:$PATH"
# Cargo
export PATH="$CARGO_HOME/bin:$PATH"
EOF
if [[ "$OSTYPE" == "darwin"* ]]; then
cat << 'EOF' >> ~/.zprofile
# Homebrew
export PATH="/usr/local/sbin:$PATH"
# Visual Studio Code
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
EOF
fi
echo ".zprofile created, restart shell to apply changes"
fi
# .zshenv
if [ ! -f ~/.zshenv ]; then
cat << 'EOF' > ~/.zshenv
# DO NOT MODIFY
# Homebrew
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_ENV_HINTS=1
# Go
export GOPATH="$HOME/.go"
export GOBIN="$GOPATH/bin"
# fzf
export FZF_DEFAULT_OPTS='--color 16'
EOF
echo ".zshenv created, restart shell to apply changes"
fi
function ocrmypdf() {
docker run -i --rm jbarlow83/ocrmypdf --output-type pdfa --pdfa-image-compression jpeg - - <"$1" >"$1.pdf"
}
function tldr() {
docker run -it --rm aluxian/tldr --update $@
}
function async() {
local job_func_name=$1
if [[ ! $job_func_name =~ ^[a-zA-Z0-9_]+$ ]]; then
echo "async: job_func_name must be an alphanumeric string with no spaces and only underscores"
return 1
fi
async_start_worker $job_func_name
async_job $job_func_name $job_func_name
}
alias ll='ls -lh'
alias la='ls -alh'
alias bi='brew install'
alias bu='brew upgrade'
alias dk='docker'
alias dc='docker compose'
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gb='git branch --sort=-committerdate'
alias gc='git commit'
alias gcl='git clone'
alias gco='git checkout'
alias gd='git diff'
alias gf='git fetch'
alias gl='git log'
alias gm='git merge'
alias gp='git push'
alias gpl='git pull'
alias gplr='git pull --rebase'
alias gpsom='git push --set-upstream origin master'
alias gpsup='git push --set-upstream origin (git symbolic-ref --short HEAD)'
alias gs='git status'
alias gsh='git show'
alias gt='git tag'
alias k='kubectl'
alias kctx='kubectx'
alias kns='kubens'
alias tf='terraform'
alias barc='brew autoremove && brew cleanup'
alias c='cat'
alias nr='npm run'
alias ns='npm start'
alias nt='npm test'
alias ntw='npm test -- --watch'
alias npr='npm prune'