-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
217 lines (189 loc) · 7.06 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
# Path to your oh-my-zsh installation.
export ZSH=/Users/paul/.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.
export ZSH_THEME="paulfioravanti"
# 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)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
brew
bundler
dotenv
fancy-ctrl-z
fasd
git
gitfast
github
macos
tmux
tmuxinator
z
)
# User configuration
# zsh-specific config:
# https://superuser.com/questions/598810/zsh-config-to-export-or-not-to-export/598924#598924
typeset -U path
path=(
/opt/homebrew/bin
/usr/local/bin
/usr/local/share/npm/bin
/usr/local/sbin
/usr/bin
/usr/sbin
/sbin
/bin
~/.local/bin
$PATH
)
export MANPATH="/usr/local/man:$MANPATH"
# REF: https://stackoverflow.com/questions/18371970/ruby-aliased-to-bundled-ruby
export UNBUNDLED_COMMANDS=(rubocop)
# Disable Oh-My-Zsh updates: it will get done when the `update` function
# is run
export DISABLE_UPDATE_PROMPT=true
source $ZSH/oh-my-zsh.sh
# Get ANSI colours in iTerm2
export CLICOLOR=1
# Set colors to match iTerm2 Terminal colours
export TERM=xterm-256color
# Declare vim to be the default editor
export EDITOR=vim
# Give ls some colour
export LSCOLORS=gxfxcxdxbxegedabagacad
# Enable IEx shell history
export ERL_AFLAGS="-kernel shell_history enabled"
# FZF fuzzy finder default options for Solarized Dark
# https://github.com/junegunn/fzf/wiki/Color-schemes#alternate-solarized-lightdark-theme
# NOTE: Not sure if I want to keep this here or move it into a
# ~/.vim/settings/fzf.vim config file using `let g:fzf_colors`.
export FZF_DEFAULT_OPTS="
--color fg:-1,bg:-1,hl:33,fg+:254,bg+:235,hl+:33
--color info:136,prompt:136,pointer:230,marker:230,spinner:136
"
# REF: https://github.com/junegunn/fzf/issues/128#issuecomment-313638882
# REF: https://github.com/ggreer/the_silver_searcher/wiki/Advanced-Usage
# export FZF_DEFAULT_COMMAND='ag --path-to-ignore ~/.ignore --filename-pattern ""'
export FZF_CTRL_T_COMMAND='ag --path-to-ignore ~/.ignore --filename-pattern ""'
# Enable call outs to scripts in steno command dictionaries.
export STENO_DICTIONARIES="$HOME/steno/steno-dictionaries"
# pyqt5 install
# REF: https://stackoverflow.com/questions/74393139/pipenv-cant-install-pyqt5
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:/opt/homebrew/opt/qt@5/bin:$PATH"
# Added for Quantum Mechanical Keyboard (QMK) firmware
export QMK_HOME="$HOME/c/qmk_firmware"
export SHELL=/bin/zsh
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# alias ls="ls -FlAagG" # more detail with default `ls`
# NOTE: Use Eza (https://eza.rocks/) for ls
alias ls="eza --header --long --group-directories-first --git --all"
# delete all local branches that have been merged into master, excluding current
# branch, develop, and master
alias gsweep='
git branch --merged master
| command grep -vE "^(\*|\s*develop\s*|\s*master\s*|\s*main\s*$)"
| command xargs -n 1 git branch -d
'
# For whatever reason, the mux alias built into tmuxinator doesn't seem to
# be working, so just set it manually
alias mux=tmuxinator
# In order to do things like find . -name "*.ex" | map wc -l
alias map="xargs -n1"
# REF: https://plover.readthedocs.io/en/latest/cli_reference.html
alias plover=/Applications/Plover.app/Contents/MacOS/Plover
# REF: https://asdf-vm.com/guide/getting-started.html#_3-install-asdf
. $(brew --prefix asdf)/libexec/asdf.sh
# Added to hook in direnv.
# REF: https://direnv.net/docs/hook.html#zsh
eval "$(direnv hook zsh)"
## Dotenv
# NOTE: oh-my-zsh dotenv doesn't seem to expand these in a way that Plover is
# able to read them from an interactive shell. So, expand them manually here.
set -o allexport
source "$HOME/.env"
set +o allexport
# REF: https://github.com/junegunn/fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Functions
# One function to update all development dependencies
function update() {
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
reset=$(tput sgr0)
cd ~
echo "${yellow}Running Brew updates...${reset}"
if brew update && brew outdated && brew upgrade && brew cleanup; then
echo "${green}Brew updates done.${reset}"
else
echo "${red}Brew updates failed.${reset}"
fi
echo "${yellow}Running Brew Cask updates...${reset}"
# https://github.com/buo/homebrew-cask-upgrade#usage
if brew cu --all --cleanup --yes && brew cleanup; then
echo "${green}Brew Cask updates done.${reset}"
else
echo "${red}Brew Cask updates failed.${reset}"
fi
echo "${yellow}Running Brew Bundle updates...${reset}"
if brew bundle dump --force && brew bundle; then
echo "${green}Brew Bundle updates done.${reset}"
else
echo "${red}Brew Bundle updates failed.${reset}"
fi
echo "${yellow}Running ASDF updates...${reset}"
if asdf plugin-update --all && asdf plugin list | xargs -I lang sh -c 'asdf install lang latest && asdf global lang $(asdf latest lang)'; then
echo "${green}ASDF updates done.${reset}"
else
echo "${red}ASDF updates failed.${reset}"
fi
echo "${yellow}Running Ruby gem updates...${reset}"
if gem update --system && gem update && gem cleanup; then
echo "${green}Ruby gem updates done.${reset}"
else
echo "${red}Ruby gem updates failed.${reset}"
fi
echo "${yellow}Running Node package updates...${reset}"
if npm install --global npm && npm update --global; then
echo "${green}Node package updates done.${reset}"
else
echo "${red}Node package updates failed.${reset}"
fi
echo "${yellow}Running Python package updates...${reset}"
# REF: https://stackoverflow.com/a/3452888/567863
# https://discuss.python.org/t/pip-22-3-list-list-format-freeze-can-not-be-used-with-the-outdated-option/20061/3
if pip list --outdated --format=json | jq -r '.[] | "\(.name)==\(.latest_version)"' | xargs -n1 pip install --upgrade; then
echo "${green}Python package updates done.${reset}"
else
echo "${red}Python package updates failed.${reset}"
fi
echo "${yellow}Re-shimming ASDF binaries...${reset}"
if rm -rf ~/.asdf/shims && asdf plugin-list | xargs -L 1 asdf reshim; then
echo "${green}Re-shimming of ASDF binaries done.${reset}"
else
echo "${red}Re-shimming of ASDF binaries failed.${reset}"
fi
echo "${yellow}Running Vim plugin updates...${reset}"
if vim +PlugUpdate +qall; then
echo "${green}Vim plugin updates done.${reset}"
else
echo "${red}Vim plugin updates failed.${reset}"
fi
echo "${yellow}Running Oh My Zsh updates...${reset}"
if omz update; then
echo "${green}Oh My Zsh updates done.${reset}"
else
echo "${red}Oh My Zsh updates failed.${reset}"
fi
}