diff options
author | Hsieh Chin Fan <pham@topo.tw> | 2024-11-20 18:17:32 +0800 |
---|---|---|
committer | Hsieh Chin Fan <pham@topo.tw> | 2024-11-20 18:18:15 +0800 |
commit | 88e326062c8165cba6a99a1e0f7d7ec547a31987 (patch) | |
tree | 30451b386ecdeb81ee1163176bba80f7d85b84f3 /alias | |
parent | a319735b1d31483c382d420abe2741868136af38 (diff) |
Update
Diffstat (limited to 'alias')
-rw-r--r-- | alias | 71 |
1 files changed, 34 insertions, 37 deletions
@@ -5,7 +5,7 @@ alias al="$EDITOR $SETTING_DIR/alias && source $SETTING_DIR/alias" | |||
5 | # SHELL {{{ | 5 | # SHELL {{{ |
6 | 6 | ||
7 | alias eof='IGNOREEOF=10' | 7 | alias eof='IGNOREEOF=10' |
8 | path() { echo $PATH; } # Should not use alias, because $PATH is not initialized | 8 | path() { echo $PATH | tr : '\n' } # Should not use alias, because $PATH is not initialized |
9 | eval "${shell}rc(){ | 9 | eval "${shell}rc(){ |
10 | local RCFILE=$XDG_CONFIG_HOME/${shell}/.${shell}rc | 10 | local RCFILE=$XDG_CONFIG_HOME/${shell}/.${shell}rc |
11 | vim \$RCFILE && source \$RCFILE | 11 | vim \$RCFILE && source \$RCFILE |
@@ -18,6 +18,7 @@ ps1.swap() { | |||
18 | unset PS1_bak | 18 | unset PS1_bak |
19 | fi | 19 | fi |
20 | } | 20 | } |
21 | alias zsh.sourced='zsh -o SOURCE_TRACE' | ||
21 | 22 | ||
22 | # }}} | 23 | # }}} |
23 | # CUSTOM HELPER {{{ | 24 | # CUSTOM HELPER {{{ |
@@ -49,7 +50,8 @@ prompt-vim() { | |||
49 | && eval $(<$TMPFILE tee /dev/tty) | 50 | && eval $(<$TMPFILE tee /dev/tty) |
50 | rm $TMPFILE | 51 | rm $TMPFILE |
51 | } | 52 | } |
52 | 53 | alias wcl='wc -l' | |
54 | alias battery='cat /sys/class/power_supply/CMB0/capacity' | ||
53 | 55 | ||
54 | # ls | 56 | # ls |
55 | alias ll='ls -lh' | 57 | alias ll='ls -lh' |
@@ -74,7 +76,7 @@ date.reset() { | |||
74 | # grep | 76 | # grep |
75 | alias grep='grep --color' | 77 | alias grep='grep --color' |
76 | unalias gr &>/dev/null | 78 | unalias gr &>/dev/null |
77 | gr() { grep -IR $@ . | sed '/^.\{2048\}./d'; } | 79 | gr() { grep --exclude-dir='\.git' -r $@ . | sed '/^.\{2048\}./d'; } |
78 | highlight() { grep --color -E "$1|\$"; } | 80 | highlight() { grep --color -E "$1|\$"; } |
79 | 81 | ||
80 | # cron | 82 | # cron |
@@ -128,9 +130,10 @@ file.size() { | |||
128 | alias s='sudo systemctl' | 130 | alias s='sudo systemctl' |
129 | alias j='sudo journalctl -xeu' | 131 | alias j='sudo journalctl -xeu' |
130 | # }}} | 132 | # }}} |
131 | # TMUX {{{ | 133 | # TTY {{{ |
132 | alias tma='tmux a' | 134 | alias tma='tmux a' |
133 | alias tmux.config="$EDITOR ~/.tmux.conf" | 135 | alias tmux.config="$EDITOR ~/.tmux.conf" |
136 | alias terminal.color='printf "\e[%dm%d dark\e[0m \e[%d;1m%d bold\e[0m\n" {30..37}{,,,}' | ||
134 | # }}} | 137 | # }}} |
135 | # NETWORK {{{ | 138 | # NETWORK {{{ |
136 | 139 | ||
@@ -148,6 +151,10 @@ ip.neigh() { | |||
148 | } | 151 | } |
149 | 152 | ||
150 | # }}} | 153 | # }}} |
154 | # GPG {{{ | ||
155 | alias gpg.bye='gpg-connect-agent reloadagent /bye' | ||
156 | alias gpg.config="$EDITOR ~/.gnupg/gpg-agent.conf" | ||
157 | # }}} | ||
151 | # MAIL {{{ | 158 | # MAIL {{{ |
152 | alias smtp.conf='sudo vim /etc/smtpd/smtpd.conf' | 159 | alias smtp.conf='sudo vim /etc/smtpd/smtpd.conf' |
153 | alias m='mutt' | 160 | alias m='mutt' |
@@ -253,7 +260,12 @@ alias xii='`fc -ln -1` | head -1 | xsel -ib' | |||
253 | alias xo='xsel -ob' | 260 | alias xo='xsel -ob' |
254 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' | 261 | alias xl='history | tail -1 | grep -oP "^\s*[0-9]+\s\s\K.*" | xsel -ib && echo Copied to clipboard && xsel -ob' |
255 | # }}} | 262 | # }}} |
263 | # X11: Misc {{{ | ||
264 | alias x='xdg-open' | ||
265 | alias ob.rc='vim ~/.config/openbox/rc.xml' | ||
266 | # }}} | ||
256 | # EDITOR: VIM {{{ | 267 | # EDITOR: VIM {{{ |
268 | alias editor='select-editor' | ||
257 | alias vimrc='vim ~/.vimrc' | 269 | alias vimrc='vim ~/.vimrc' |
258 | if which nvim &>/dev/null; then | 270 | if which nvim &>/dev/null; then |
259 | alias vim='nvim' | 271 | alias vim='nvim' |
@@ -298,7 +310,7 @@ alias cdP='cd ~/Pictures' | |||
298 | alias cdpu='cd ~/public' | 310 | alias cdpu='cd ~/public' |
299 | alias cdV='cd ~/Videos' | 311 | alias cdV='cd ~/Videos' |
300 | alias cdM='cd ~/Music' | 312 | alias cdM='cd ~/Music' |
301 | 313 | alias cdtrash='cd ~/.local/share/Trash' | |
302 | # }}} | 314 | # }}} |
303 | # BLOG {{{ | 315 | # BLOG {{{ |
304 | alias cdb='cd ~/blog' | 316 | alias cdb='cd ~/blog' |
@@ -362,7 +374,7 @@ upload_tig() { | |||
362 | action=overwrite | 374 | action=overwrite |
363 | } | 375 | } |
364 | # }}} | 376 | # }}} |
365 | # GiT: GIST {{{ | 377 | # GIT: GIST {{{ |
366 | alias g='gist' | 378 | alias g='gist' |
367 | alias gl='gist last' | 379 | alias gl='gist last' |
368 | unalias gg &>/dev/null | 380 | unalias gg &>/dev/null |
@@ -395,10 +407,6 @@ github.raw() { | |||
395 | } | 407 | } |
396 | 408 | ||
397 | # }}} | 409 | # }}} |
398 | # Beancount{{{ | ||
399 | alias cdB='cd $HOME/bean' | ||
400 | alias b='vim $HOME/bean/main.bean' | ||
401 | # }}} | ||
402 | # DEV: Docker{{{ | 410 | # DEV: Docker{{{ |
403 | alias dk='docker' | 411 | alias dk='docker' |
404 | alias dc='docker-compose' | 412 | alias dc='docker-compose' |
@@ -423,10 +431,16 @@ adb.push() { | |||
423 | adb push $1 /sdcard/Download | 431 | adb push $1 /sdcard/Download |
424 | } | 432 | } |
425 | # }}} | 433 | # }}} |
434 | # Beancount{{{ | ||
435 | alias cdB='cd $HOME/bean' | ||
436 | alias b='vim $HOME/bean/main.bean' | ||
437 | # }}} | ||
426 | # python{{{ | 438 | # python{{{ |
427 | alias pip3='python3 -m pip' | 439 | alias pip3='python3 -m pip' |
428 | # }}} | 440 | # }}} |
429 | # sample file{{{ | 441 | # sample file{{{ |
442 | alias foo='echo bar > foo && echo File foo is created && ls -lh foo' | ||
443 | alias bar='echo foo > bar && echo File bar is created && ls -lh bar' | ||
430 | alias sample.text='curl http://metaphorpsum.com/paragraphs/3/5' | 444 | alias sample.text='curl http://metaphorpsum.com/paragraphs/3/5' |
431 | alias sample.gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' | 445 | alias sample.gpx='curl -O https://docs.mapbox.com/help/data/run.gpx' |
432 | alias sample.geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' | 446 | alias sample.geojson='curl -O https://docs.mapbox.com/help/data/stations.geojson' |
@@ -507,21 +521,6 @@ TAIWAN_BBOX='118.1036,20.72799,122.9312,26.60305' | |||
507 | TAIWAN_BBOX_V='20.72799,118.1036,26.60305,122.9312' | 521 | TAIWAN_BBOX_V='20.72799,118.1036,26.60305,122.9312' |
508 | TAIPEI_BBOX='121.346,24.926,121.676,25.209' | 522 | TAIPEI_BBOX='121.346,24.926,121.676,25.209' |
509 | TAIPEI_BBOX_V='24.926,121.346,25.209,121.676' | 523 | TAIPEI_BBOX_V='24.926,121.346,25.209,121.676' |
510 | # }}} | ||
511 | # Misc{{{ | ||
512 | alias gpg.config="$EDITOR ~/.gnupg/gpg-agent.conf" | ||
513 | alias foo='echo bar > foo && echo File foo is created && ls -lh foo' | ||
514 | alias bar='echo foo > bar && echo File bar is created && ls -lh bar' | ||
515 | alias wcl='wc -l' | ||
516 | alias x='xdg-open' | ||
517 | alias yl='youtube-dl' | ||
518 | alias yla='youtube-dl -x --audio-format mp3' | ||
519 | yt.audio() { | ||
520 | yt-dlp --verbose -x --audio-format mp3 --add-metadata $1 | ||
521 | } | ||
522 | alias editor='select-editor' | ||
523 | alias hp='http-prompt' | ||
524 | alias clocg='cloc --vcs=git' | ||
525 | pbf() { | 524 | pbf() { |
526 | protoc --decode_raw | 525 | protoc --decode_raw |
527 | } | 526 | } |
@@ -535,20 +534,18 @@ mvt.decode() { | |||
535 | mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g; s/False/false/g' | 534 | mvt_decode.py $tmp | tr \' \" | sed 's/True/true/g; s/False/false/g' |
536 | } | 535 | } |
537 | wrap2geojson() { jq -s '{ type: "FeatureCollection", features: . }'; } | 536 | wrap2geojson() { jq -s '{ type: "FeatureCollection", features: . }'; } |
538 | alias cdtrash='cd ~/.local/share/Trash' | 537 | # }}} |
538 | # Misc{{{ | ||
539 | alias yl='youtube-dl' | ||
540 | alias yla='youtube-dl -x --audio-format mp3' | ||
541 | yt.audio() { | ||
542 | yt-dlp --verbose -x --audio-format mp3 --add-metadata $1 | ||
543 | } | ||
544 | alias hp='http-prompt' | ||
545 | alias clocg='cloc --vcs=git' | ||
539 | trash() { mv $@ ~/.local/share/Trash; } | 546 | trash() { mv $@ ~/.local/share/Trash; } |
540 | alias ge='graph-easy --boxart' | 547 | alias ge='graph-easy --boxart' |
541 | # }}} | ||
542 | # tmp{{{ | ||
543 | alias stew='cd ~/git/mapstew' | ||
544 | alias vc='vultr-cli' | ||
545 | alias xkb='cd $SETTING_DIR && make xkb' | ||
546 | alias thsr='curl -L google.com >/tmp/foo.html && xdg-open /tmp/foo.html' | ||
547 | todo() { cd ~/log && grep -R ' TODO ' --exclude-dir=logseq/; } | ||
548 | fix() { which $1 && grep -Po 'FIXME.*' $(which $1); } | ||
549 | alias ffmpeg='ffmpeg -hide_banner' | 548 | alias ffmpeg='ffmpeg -hide_banner' |
550 | alias md='reveal' | ||
551 | alias terminal.color='printf "\e[%dm%d dark\e[0m \e[%d;1m%d bold\e[0m\n" {30..37}{,,,}' | ||
552 | alias gpg.bye='gpg-connect-agent reloadagent /bye' | ||
553 | alias npm='pnpm' | 549 | alias npm='pnpm' |
550 | fix() { which $1 && grep -Po 'FIXME.*' $(which $1); } | ||
554 | # }}} | 551 | # }}} |