-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.aliases.zsh
More file actions
185 lines (164 loc) · 4.67 KB
/
.aliases.zsh
File metadata and controls
185 lines (164 loc) · 4.67 KB
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
#!/bin/zsh
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) machine=Linux ;;
Darwin*) machine=Mac ;;
CYGWIN*) machine=Cygwin ;;
MINGW*) machine=MinGw ;;
*) machine="UNKNOWN:${unameOut}"
esac
# If is Linux, then use, alias `open` to `xdg-open`.
if [[ $machine == "Linux" ]]; then
alias open="xdg-open"
fi
# Basic
alias aliases="$VISUAL ~/.aliases.zsh"
# fix alias in command `watch`
# see, https://unix.stackexchange.com/a/25329
alias watch="/usr/bin/watch "
# GDB
alias gdb-peda="gdb -ex init-peda"
alias gdb-pwndbg="gdb -ex init-pwndbg"
alias gdb-gef="gdb -ex init-gef"
# Django
alias pm-mm="python manage.py makemigrations"
alias pm-r="python manage.py runserver"
alias pm-m="python manage.py migrate"
# Shell
alias c=clear
alias f=file
alias ct='ccat'
alias pc='proxychains4 -q'
alias dry='TERM=xterm dry'
alias dose='docker-compose'
alias kose='kompose'
alias dm='docker-machine'
alias or='optirun'
alias zshrc="$VISUAL ~/.zshrc"
alias zinitrc="$VISUAL ~/.zinit.zsh"
alias vimrc="$VISUAL ~/.vimrc"
alias nvimrc="cd ~/.config/astronvim_v4/ && nvim . && cd -"
alias ipad="ip addr | grep inet && hostname -i"
alias cdp="cd ~/playground" # change to the playground
alias cdd="cd ~/Downloads" # change to the Downloads
alias cdo="cd ~/Documents/onedrive"
tt ()
{
today=$(date -u '+%y%m%d')
take ~/playground/${today}
}
alias h="htop"
alias nv="nvim"
alias nv.="nvim ."
alias nvc="nvim --clean -u $HOME/.config/nvim/lua/fky/options.lua"
alias anv="anvim"
alias lnvim="NVIM_APPNAME=lazynvim nvim"
alias v="vim"
alias n="nvim"
# Onedrive
alias one="onedrive --synchronize"
alias one-d="onedrive --monitor --verbose"
# only backup, never delete remotely
alias oned='onedrive --synchronize --confdir="~/.config/onedriveEdu" --upload-only --no-remote-delete'
alias cdg="cd ~/Documents/gdrive"
alias p="pwd" # shorter
# alias tmux="tmux -2" # fix the problem with vim
alias ta="tmux a"
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
IFS= read -r -d '' cwd < "$tmp"
[ -n "$cwd" ] && [ "$cwd" != "$PWD" ] && builtin cd -- "$cwd"
rm -f -- "$tmp"
}
alias tmuxrc="vim ~/.tmux.conf"
alias destory="/bin/rm"
alias pwq='pwd | tr -d "\n" |xclip -selection c && pwd '
alias asd='code .'
alias cdt='cd /tmp'
alias yaourt="yay"
alias tb='taskbook'
alias hex='hexyl'
alias rl="rlwrap"
alias paxel="pc axel -n 10"
alias sml="rl sml"
alias cdc="cd ~/code"
alias cdi="cd ~/code/incubators"
alias telegram="QT_QPA_PLATFORMTHEME="" QT_STYLE_OVERRIDE="" telegram-desktop"
alias yd=ydcv
alias ub="proxychains4 -q zdict --dict urban"
alias nau='nautilus .'
alias pm='python manage.py'
# ctf usage
alias xb64d='xsel -ob 2>/dev/null | base64 -d'
alias xb64="xsel -ob 2>/dev/null | base64"
alias windows="mount.ntfs /dev/sda3 /mnt/"
alias glc="gl origin $(git branch --show-current)"
alias qemu="qemu-system-x86_64"
alias mine="cd ~/code/git/mine"
alias ssr="electron-ssr"
alias ls="eza"
alias ll="eza -al"
# LaTeX
# https://wiki.archlinux.org/title/TeX_Live
alias tlmgr="/usr/share/texmf-dist/scripts/texlive/tlmgr.pl --usermode"
# Rust
alias cb="cargo b"
alias cbr="cargo b --release"
alias de="direnv edit"
alias sp="set_proxy"
alias usp="unset_proxy"
# Nix
alias home="nvim $HOME/.config/home-manager/home.nix"
# Github Copilot CLI
copilot_what-the-shell () {
TMPFILE=$(mktemp);
trap 'rm -f $TMPFILE' EXIT;
if github-copilot-cli what-the-shell "$@" --shellout $TMPFILE; then
if [ -e "$TMPFILE" ]; then
FIXED_CMD=$(cat $TMPFILE);
print -s "$FIXED_CMD";
eval "$FIXED_CMD"
else
echo "Apologies! Extracting command failed"
fi
else
return 1
fi
};
alias '??'='copilot_what-the-shell';
copilot_git-assist () {
TMPFILE=$(mktemp);
trap 'rm -f $TMPFILE' EXIT;
if github-copilot-cli git-assist "$@" --shellout $TMPFILE; then
if [ -e "$TMPFILE" ]; then
FIXED_CMD=$(cat $TMPFILE);
print -s "$FIXED_CMD";
eval "$FIXED_CMD"
else
echo "Apologies! Extracting command failed"
fi
else
return 1
fi
};
alias 'git?'='copilot_git-assist';
copilot_gh-assist () {
TMPFILE=$(mktemp);
trap 'rm -f $TMPFILE' EXIT;
if github-copilot-cli gh-assist "$@" --shellout $TMPFILE; then
if [ -e "$TMPFILE" ]; then
FIXED_CMD=$(cat $TMPFILE);
print -s "$FIXED_CMD";
eval "$FIXED_CMD"
else
echo "Apologies! Extracting command failed"
fi
else
return 1
fi
};
alias 'gh?'='copilot_gh-assist';
alias 'wts'='copilot_what-the-shell';
alias sg=ast-grep
alias k9='k9s --kubeconfig $(find ~/.kube -maxdepth 1 -not -type d | fzf)'