-
Notifications
You must be signed in to change notification settings - Fork 4
/
.zshrc
158 lines (138 loc) · 3.89 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
##
# odyslam - .zshrc
#
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
export TERM=xterm
fi
export GPG_TTY=$(tty)
export PATH="/opt/homebrew/opt/openssl@3/bin:/bin:$PATH"
#
# Includes
#
autoload colors && colors
autoload -U compinit && compinit
autoload -U complist
# Fzy integration
if command -v fzy >/dev/null 2>&1 && test -f ~/.fzy.zsh; then
source ~/.fzy.zsh
fi
# Fzy history search doesn't sort things in a useful way, so we use zsh for now.
bindkey '^R' history-incremental-search-backward
#
# Aliases
#
# Foundry
alias fb="forge build"
alias ft="forge test"
# GitHub
alias g='git'
alias ga="git -a ."
alias gc"git commit"
# Cargo
alias c="cargo"
alias cc="cargo check"
alias cb="cargo build"
alias ct="cargo test"
alias cl="cargo check --all && cargo test --all --all-features && cargo +nightly fmt -- --check && cargo +nightly clippy --all --all-features -- -D warnings"
# Wrangler -- Cloudflare Workers
alias wd="wrangler dev"
alias wp="wrangler publish"
# Javascript
alias y="yarn"
# Bash
alias v="nvim"
alias mk='make'
alias ..='cd ..'
alias df='df -h'
alias e=$EDITOR
alias vim=nvim
alias vi=nvim
alias diskusage='ncdu'
alias t=tree-git-ignore
alias tmh="tmux splitw -h"
alias tmv="tmux splitw -v"
alias ga='gatsby'
alias gad='gatsby develop'
alias gac='gatsby clean'
alias cat='bat'
alias ls='exa'
alias flint='cargo +nightly fmt -- --check && cargo +nightly clippy --all --all-features -- -D warnings'
alias ftest='cargo check --all && cargo test --all --all-features'
# Utils
alias dnsflush="sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder"
function tree-git-ignore {
local ignored=$(git ls-files -ci --others --directory --exclude-standard)
local ignored_filter=$(echo "$ignored" \
| egrep -v "^#.*$|^[[:space:]]*$" \
| sed 's~^/~~' \
| sed 's~/$~~' \
| tr "\\n" "|")
tree --prune -I ".git|${ignored_filter: : -1}" "$@"
}
#
# History
#
HISTFILE=~/.zsh_history
HISTSIZE=65536
SAVEHIST=65536
REPORTTIME=10
# Treat the '!' character specially during expansion.
setopt BANG_HIST
# Write the history file in the ":start:elapsed;command" format.
setopt EXTENDED_HISTORY
# Write to the history file immediately, not when the shell exits.
setopt INC_APPEND_HISTORY
# Expire duplicate entries first when trimming history.
setopt HIST_EXPIRE_DUPS_FIRST
# Don't record an entry that was just recorded again.
setopt HIST_IGNORE_DUPS
# Delete old recorded entry if new entry is a duplicate.
setopt HIST_IGNORE_ALL_DUPS
# Do not display a line previously found.
setopt HIST_FIND_NO_DUPS
# Don't write duplicate entries in the history file.
setopt HIST_SAVE_NO_DUPS
# Remove superfluous blanks before recording entry.
setopt HIST_REDUCE_BLANKS
autoload up-line-or-beginning-search
autoload down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "\e[A" up-line-or-beginning-search
bindkey "\e[B" down-line-or-beginning-search
#
# Options
#
setopt NO_BG_NICE
setopt NO_HUP
setopt NO_LIST_BEEP
setopt LOCAL_OPTIONS
setopt LOCAL_TRAPS
setopt EXTENDED_HISTORY
setopt PROMPT_SUBST
setopt CORRECT
setopt COMPLETE_IN_WORD
setopt NO_IGNORE_EOF
setopt AUTO_CD
setopt INTERACTIVECOMMENTS
# Oh my zsh
ZSH_THEME="agnoster"
SOLARIZED_THEME=light
ENABLE_CORRECTION="true"
COMPLETION_WAITING_DOTS="true"
ZSH_COMMAND_TIME_MIN_SECONDS=1
plugins=(git docker copybuffer textmate tmux sudo zsh-syntax-highlighting zsh-autosuggestions command-time zsh-vi-mode)
ZSH_TMUX_AUTOSTART="true"
source ~/.oh-my-zsh/oh-my-zsh.sh
# Quote prompt
quote_api_reply=$(curl -sS api.quotable.io/random)
author=$(echo $quote_api_reply | jq .author)
quote=$(echo $quote_api_reply | jq .content)
echo -e "$quote\n-$author"
# setup NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
# Setup rbenv, thefuck
eval "$(rbenv init - zsh)"
eval $(thefuck --alias)