-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc_local
187 lines (160 loc) · 5.35 KB
/
.zshrc_local
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
# General alias
alias router="netstat -nr|grep default" # router ip addr
alias leetcode="nvim leetcode.nvim"
alias exrdeploy="(cexr && pack editxr.tgz --exclude=node_modules --exclude=dist --exclude=editxr.tgz * && gcloud builds submit editxr.tgz)"
alias man="batman"
alias less="batpipe"
alias watch="batwatch"
alias diff="batdiff"
alias rg="batgrep"
alias skim="/Applications/Skim.app/Contents/MacOS/Skim"
present() {
jupyter dejavu "$1" --template reveal
open "${1%.*}.html"
}
alias ard="arduino-cli"
mov2mp4() {
avconvert --source "$1" --output "${1%.*}.mp4" --preset PresetHighestQuality
}
vidstack() {
if [ "$1" = "--audio" ]; then
ffmpeg -i "$2" -i "$3" -filter_complex "[0:v][1:v]hstack=inputs=2[v]" -map "[v]" -map "0:a" stacked.mp4
else
ffmpeg -i "$1" -i "$2" -filter_complex "[0:v][1:v]hstack=inputs=2[v]" -map "[v]" stacked.mp4
fi
}
cpd() {
latest_file=$(find ~/Downloads -type f -maxdepth 1 -print0 | xargs -0 ls -t | head -1)
if [ -z "$latest_file" ]; then
echo "No files found in Downloads directory"
return 1
fi
echo "Most recent file is: $latest_file"
echo -n "Do you want to copy this file? (y/n) "
read confirm
if [[ $confirm =~ ^[Yy]$ ]]; then
cp "${latest_file}" "${1:-.}"
else
echo "Copy cancelled"
fi
}
mvd() {
latest_file=$(find ~/Downloads -type f -maxdepth 1 -print0 | xargs -0 ls -t | head -1)
if [ -z "$latest_file" ]; then
echo "No files found in Downloads directory"
return 1
fi
echo "Most recent file is: $latest_file"
echo -n "Do you want to move this file? (y/n) "
read confirm
if [[ $confirm =~ ^[Yy]$ ]]; then
mv "${latest_file}" "${1:-.}"
else
echo "Move cancelled"
fi
}
# abduco stuff
alias ab="abduco -e ^q"
abc() {
abduco -e ^q -c "$1"
}
aba() {
abduco -e ^q -a "$1"
}
abk() {
pkill -f "abduco.*$1"
}
abm() {
abduco -e ^q -c "$1" mosh "$2"
}
abmhetzner() {
abduco -e ^q -c "$1" mosh [email protected]
}
# Config alias
alias yadmc="vim ~/.config/yadm/bootstrap"
alias macc="vim ~/.config/yadm/mac-install.yml"
alias yabaic="vim ~/.config/yabai/yabairc"
alias skhdc="vim ~/.config/skhd/skhdrc"
alias sketchybarc="vim ~/.config/sketchybar/sketchybarrc"
alias wezc="vim ~/.wezterm.lua"
alias kittyc="vim ~/.config/kitty/kitty.conf"
alias ghosttyc="vim ~/Library/Application\ Support/com.mitchellh.ghostty/config"
# cd alias
alias cyadm="c ~/.config/yadm"
alias csketchybar="c ~/.config/sketchybar/"
alias cexr="c ~/Repos/Personal/EditXR"
alias crepos="c ~/Repos"
alias cwork="c ~/Repos/Work"
alias cschool="c ~/Repos/School"
alias cpersonal="c ~/Repos/Personal"
alias csu="c ~/Drive/usa/school/su"
alias cleetcode="c ~/Repos/Personal/leetcode"
alias cdownloads="c ~/Downloads"
alias cusa="c ~/Drive/usa/"
# yadm alias
alias ycommit="yadm commit -am"
alias ystatus="yadm status"
alias ydiff="yadm diff | prettybat"
alias yadd="yadm add"
alias ypull="yadm pull"
alias ypush="yadm push"
alias yclean="yadm clean -dfx"
alias yreset="yadm reset --hard HEAD"
alias ynuke="yadm clean -dfx && yadm reset --hard HEAD"
# SSH alias
alias synchetzner="syncssh [email protected]"
# custom scripts
alias colortest="~/.config/yadm/scripts/colortest.sh"
alias syncssh="~/.config/yadm/scripts/sync_ssh.sh"
# python pacakges required for jupyter + vim
alias condavimdeps="conda install pynvim jupyter_client jupytext ipython ipykernel pylatexenc"
# python packages for general ds work
alias condadsdeps="conda install numpy matplotlib scikit-learn pandas pytorch"
## sgqlc: graphql client for github auto-readme
alias condaotherdeps="conda install sgqlc"
## 1password-cli stuff
alias optoken="op read op://Personal/$1/token"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
conda activate py312
export PATH="/opt/homebrew/opt/ruby/bin:$PATH"
export PATH="$(gem environment gemdir)/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
# for image.nvim
export DYLD_LIBRARY_PATH="$(brew --prefix)/lib:$DYLD_LIBRARY_PATH"
# powerlevel10k
source /opt/homebrew/share/powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# # plugin customizations
BREW=$(brew --prefix)
source $BREW/share/zsh-autocomplete/zsh-autocomplete.plugin.zsh
bindkey "$terminfo[kcbt]" menu-select
bindkey -M menuselect '^I' menu-complete
bindkey -M menuselect "$terminfo[kcbt]" reverse-menu-complete
source $BREW/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(history)
ZSH_AUTOSUGGEST_HISTORY_IGNORE='(cd|ls|vim|c|l|v) *' # prevent invalid suggestions
# New widget; prioritize autosuggest, otherwise use first item in menu
_custom_tab_accept_suggestion() {
if [[ -n "$POSTDISPLAY" ]]; then
zle autosuggest-accept
else
zle menu-select
fi
}
zle -N _custom_tab_accept_suggestion
bindkey '^I' _custom_tab_accept_suggestion # tab
export HOMEBREW_EDITOR="nvim"