-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
executable file
·281 lines (230 loc) · 8.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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="sunrise"
# _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Enable command auto-correction.
ENABLE_CORRECTION="false"
# Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
ZSH_TMUX_AUTOSTART="false"
ZSH_TMUX_AUTOCONNECT="false"
plugins=(tmux wd alias-history zsh-completions git github sudo cp alias-tips command-not-found pip python common-aliases autojump colored-man-pages ubuntu)
source "$ZSH"/oh-my-zsh.sh
export LANG=en_US.UTF-8
export TERM="xterm-256color"
export VISUAL=vim
export EDITOR="$VISUAL"
# Aliases to specify version/flags
#alias python='python3'
#alias pip='pip3'
#alias virtualenv='virtualenv --python=/usr/bin/python3'
alias grep='grep --color=always'
alias less='less -R'
alias vim='vim --servername vim'
export LSCOLORS=gxfxbEaEBxxEhEhBaDaCaD
export LSCOLORS=exfxfeaeBxxehehbadacea
# Aliases to rename commands
alias cl='clear'
alias ala='clear'
alias ..='cd ..'
alias ,,='cd ..'
alias :partyparrot:='curl parrot.live'
alias whatthecommit='curl whatthecommit.com/index.txt'
alias pping='prettyping'
alias ls='exa'
alias cat='bat'
alias pana='bat'
alias tawa='cd'
alias lon='wd'
alias moli='kill'
alias weka='rm -i'
alias seme='which'
alias jo='exa'
alias ante='vim'
alias sinpin='head' # could have been lawa/(anpa/pini)
alias monsi='tail'
alias sona='man'
alias toki='echo'
alias sewi='..'
alias sama='cp'
alias fd='command fd'
alias male='make'
alias :q='exit'
alias list='ls'
alias ks='ls'
alias caps='xdotool key Caps_Lock'
alias CAPS='xdotool key Caps_Lock' # for when caps lock is on
alias weather='curl wttr.in/durham'
alias deexif='exiftool -all= *.jpg *.jpeg *.png'
alias tpquiz='python3 ~/dev/learn/tokiponaquiz/quiz.py'
#alias tpwords='cat ~/dev/learn/tokiponaquiz/tokpono-valste.json | jq -r ".[].word"'
alias quitkeybase='systemctl --user stop keybase kbfs keybase.gui'
alias vimrc='vim ~/.vim/vimrc'
# Aliases that do something complicated
alias thesaurus='~/dev/macdict/macdict2 -d "Oxford Thesaurus of English"'
alias define='~/dev/macdict/macdict2 -d "Oxford Dictionary of English"'
#alias coinflip='python -c "import random; print([\"Heads\",\"Tails\"][random.randint(0,1)]);"'
alias coinflip=~/dev/tools/coinflip/coinflip
alias work='encfs "$HOME/.encrypted" "$HOME/work_files"; cd "$HOME/work_files" && unset HISTFILE'
alias unwork='cd && fusermount -u "$HOME/work_files" && HISTFILE="$HOME/.zsh_history" && clear'
alias preview="fzf --bind \"enter:execute(vim {})+abort\" --preview 'bat --color \"always\" {}'"
export FZF_DEFAULT_OPTS="--bind='ctrl-o:execute(vim {})+abort'"
#function cwe { open "https://cwe.mitre.org/data/definitions/$1.html" }
alias incrypt='encfs "$HOME/.crypt" "$HOME/crypt"; cd "$HOME/crypt" && unset HISTFILE'
alias uncrypt='cd && fusermount -u "$HOME/crypt" && HISTFILE="$HOME/.zsh_history" && clear'
function http {
lynx "https://httpstatuses.com/$1" -dump | awk "/$1/,/Code References/"
}
function mdless() {
pandoc -s -f markdown -t man $1 | groff -T utf8 -man | less -c
}
function umedit() {
mkdir -p ~/.notes
if [ ! -f ~/.notes/$1.md ]; then
echo "% $(echo $1 | tr '[:lower:]' '[:upper:]')(shell) Um Pages | Um Page" >> ~/.notes/$1.md
echo "\n# NAME\n$1 - $(whatis $1 2> /dev/null | cut -d '-' -f 2 | awk '{$1=$1};1')\n\n# COMMANDS" >> ~/.notes/$1.md
fi
vim ~/.notes/$1.md
}
function um() { mdless ~/.notes/"$1.md"; }
function umls() { ls ~/.notes }
# Pystiler aliases
alias l='pyst move left'
alias r='pyst move right' # override r builtin
alias tl='pyst move top_left'
#alias tr='pyst move top_right' # override tr builtin
alias bl='pyst move bottom_left'
alias br='pyst move bottom_right'
alias m='pyst move maximize'
alias t='pyst move top'
alias b='pyst move bottom'
alias ws='pyst workspace'
function wso {
pyst workspace "$1"
exit
}
# Pyfortune functions
FORTUNES_DIR="$HOME/dev/pyfortune"
FORTUNES="$FORTUNES_DIR/myfortunes.txt"
function addfortune { echo "%\\n$1" >> "$FORTUNES"; }
function grepfortunes { grep "$1" "$FORTUNES"; }
function vimfortunes { vim "$FORTUNES"; }
function catfortunes { cat "$FORTUNES"; }
function pushfortunes {
cd "$FORTUNES_DIR" || exit
git add myfortunes.txt
git commit -m "Add fortunes"
git push
cd - || exit
}
# Create template C directory
function ds {
mkdir "$1" && cd "$1" || exit
sed "s/NAME/$1/g" "$HOME/Templates/MakefileCustom" > ./Makefile
cp "$HOME/Templates/template.c" "./$1.c"
pwd && ls
}
function calibreupdate {
sudo -v && wget -nv -O- https://download.calibre-ebook.com/linux-installer.py | sudo python -c "import sys; main=lambda:sys.stderr.write('Download failed\\n'); exec(sys.stdin.read()); main()"
}
function foldersize {
if [ ! -z "$1" ]
then
du -sb "$1/*" | sort -n -r | numfmt --to=iec
else
du -sb -- * | sort -n -r | numfmt --to=iec
fi
}
function extract {
for name in "$@"; do
if [ -f "$name" ] ; then
case "$name" in
*.tar.bz2) tar xvjf "$name" ;;
*.tar.xz) tar xf "$name" ;;
*.tar.gz) tar xvzf "$name" ;;
*.bz2) bunzip2 "$name" ;;
*.rar) unrar x "$name" ;;
*.gz) gunzip "$name" ;;
*.tar) tar xvf "$name" ;;
*.tbz2) tar xvjf "$name" ;;
*.tgz) tar xvzf "$name" ;;
*.zip) unzip "$name" ;;
*.Z) uncompress "$name" ;;
*.7z) 7z x "$name" ;;
*) echo "Don't know how to extract '$name'..." ;;
esac
echo "'$name' was extracted."
else
echo "'$name' is not a valid file!"
fi
done
}
function mp3 { youtube-dl --audio-format mp3 -x "$1"; }
function loss { echo "l | ll\\n--------\\n11 | l_"; }
function mkcd { mkdir "$1" && cd "$1" || exit; }
function gorep { rg "$1" -tgo -g '!*_test.go' --smart-case --sort path }
function goreptest { rg "$1" -g '*_test.go' --smart-case --sort path }
function gorepall { rg "$1" -tgo --smart-case --sort path }
function mdr { pandoc "$1" | lynx -stdin; }
function pprint_json { sed "s/'/\"/g" | python -m json.tool | pygmentize -l javascript; }
function go {
if [ "$1" = "off" ]; then
shift;
command t update "$@";
#elif [ "$1" = "team" ]; then
else
command go "$@";
fi
}
export GEM_HOME="$HOME/gems"
export GOPATH="$HOME/gopath:$HOME/gocode/"
export PYENV_ROOT="$HOME/.pyenv"
PATH="$HOME/gems/bin:$PATH"
PATH="$PYENV_ROOT/bin:/usr/bin:$PATH:/usr/local/go/bin:$HOME/gopath/bin"
PATH="$HOME/.cargo/bin:$PATH"
PATH="/opt/firefox:$PATH"
PATH="$GOPATH:$GOPATH/bin:$PATH:/home/riley/dev/tools/biotext"
PATH="$HOME/.local/bin:/home/$USER/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH:$HOME/dev/tools"
export PATH
export LD_LIBRARY_PATH="/usr/local/lib:/lib:$LD_LIBRARY_PATH"
export NVM_DIR="/home/$USER/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
/usr/bin/ssh-add
}
if [ -f "${SSH_ENV}" ]; then
. "${SSH_ENV}" > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
start_agent;
}
else
start_agent;
fi
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"
source ~/.bin/tmuxinator.zsh
eval "$(pipenv --completion)"
eval "$(thefuck --alias)"
eval "$(thefuck --alias please)"
eval "$(thefuck --alias pakala)"
if [ -z "$TMUX" ]; then
mux start default -n "$(random-words 2)"
fi
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then
source /etc/profile.d/vte.sh
fi
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
PATH="/home/riley/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="/home/riley/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="/home/riley/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"/home/riley/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=/home/riley/perl5"; export PERL_MM_OPT;