dotfiles/dot_config/private_fish/abbreviations.fish.tmpl
2024-01-17 10:24:24 +09:00

410 lines
11 KiB
Cheetah

# flush all abbreviations
for i in (abbr -l);
abbr -e $i;
end;
# ---------------------
abbr e "$EDITOR"
abbr se "sudo $EDITOR"
abbr vim "$EDITOR"
abbr vd 'nvim -d'
abbr vimd 'nvim -d'
abbr vimr 'nvim -R'
abbr Vim "vim"
abbr bash 'bash --rcfile ~/.config/bash/bashrc'
abbr df 'df -h'
abbr mv 'mv'
abbr less 'less -R'
abbr grep 'grep -n --color=always'
# abbr tree 'battree'
abbr tree 'batexa -a --tree --git-ignore --level=3'
abbr x 'xargs -I\'{}\''
abbr sedi "sed -i --follow-symlink 's///g'"
abbr cc 'copy-contents'
abbr P/ 'batpacsearch'
abbr Pc 'sudo paru -Rns (paru -Qtdq)'
abbr Pq 'paru -Q | fzf | awk \'{print $1}\' | xargs -I\'{}\' paru -Qi {}'
abbr Pr 'paru -Rs (paru -Q | fzf | awk \'{print $1}\' | xargs -I\'{}\' paru -Qi {} | head -1 | awk -F\' : \' \'{print $2}\')'
abbr Ps 'paru -S --skipreview --noconfirm'
abbr Pu 'paru -Syu --skipreview --noconfirm --quiet'
abbr uln 'unlink'
abbr cal 'cal -w -m'
if type -q update-all.sh
abbr ua 'update-all.sh'
end
if type -q unplug-key.sh
abbr uk 'unplug-key.sh'
end
abbr udb 'doas updatedb'
abbr ka 'killall'
# mozc setting dialog
if test -x /usr/lib/mozc/mozc_tool
abbr mozc-config '/usr/lib/mozc/mozc_tool --mode=config_dialog'
end
# youtube-dl abbreviations
# if type -q youtube-dl;
# abbr yd 'youtube-dl'
# abbr ydlomni 'youtube-dl --config-location "~/.config/youtube-dl/v-list"'
# # abbr ydl 'youtube-dl --config-location "~/.config/youtube-dl/v-list-u"'
# abbr ydl 'youtube-dl-parallel-list'
# abbr yda 'youtube-dl --config-location "~/.config/youtube-dl/audio"'
# abbr ydal 'youtube-dl --config-location "~/.config/youtube-dl/a-list"'
# end
abbr yd 'yt-dlpueue'
if type -q ytfzfdl;
abbr yfd ytfzfdl
end
# ffmpeg-wrapper(s)
if type -q ffmpeg;
type -q ffmpeg-split; and abbr ffsp 'ffmpeg-split'
type -q ffmpeg-wrapper; and abbr ffw 'ffmpeg-wrapper'
end
# Play youtube through mpv
# abbr yp 'setsid mpv --no-terminal --ytdl-raw-options=sub-lang=en --sid=1 --pause'
abbr yp 'mpv-play-youtube'
abbr yt "mpvytl --changed-within 3d"
abbr m "setsid mpv --no-terminal"
# nnn (filemanger)
if type -q nnn;
abbr nn 'nnn -Hrd'
if test -d /mnt/hdd
abbr nnh 'nnn -Hrd /mnt/hdd/'
end
if test -d /mnt/rpi4
abbr nnr 'nnn -Hrd /mnt/rpi4'
end
end
# systemd (systemctl)
abbr S 'sudo systemctl'
abbr Sr 'sudo systemctl restart'
abbr Ss 'sudo systemctl start'
abbr St 'sudo systemctl status'
abbr Se 'sudo systemctl enable'
abbr Sd 'sudo systemctl disable'
abbr Sp 'sudo systemctl stop'
abbr Su 'systemctl --user'
abbr Sur 'systemctl --user restart'
abbr Sus 'systemctl --user start'
abbr Sut 'systemctl --user status'
abbr Sue 'systemctl --user enable'
abbr Sud 'systemctl --user disable'
abbr Sup 'systemctl --user stop'
abbr Jc 'sudo journalctl'
abbr Jcu 'journalctl --user'
# poweroff
abbr pwo 'poweroff'
# change directory
abbr - 'cd -'
abbr .. 'cd ..'
abbr ... 'cd ../..'
abbr .... 'cd ../../..'
abbr ..... 'cd ../../../..'
abbr D 'cd ~/dl'
abbr M 'fuzzy-find -t d --exec /run/media/inkch/ 3'
abbr srv 'fuzzy-find -t d --exec /srv 3'
abbr jelly 'fuzzy-find -t d --exec /srv/jellyfin 3'
abbr hdd 'fuzzy-find -t d --exec /mnt/hdd 3'
abbr hdd2 'fuzzy-find -t d --exec /mnt/hdd2 3'
abbr BK 'fuzzy-find -t d --exec /mnt/hdd/bk 3'
abbr R 'fuzzy-find -t d --exec /mnt/rpi4 2'
abbr T 'cd ~/dl/torrent'
abbr cdw 'fuzzy-find -t d --exec ~/ws'
abbr f. 'fuzzy-find -t d --exec . 5'
abbr f.. 'bd'
abbr cdc 'fuzzy-find -t d --exec ~/.config 3'
abbr cdd 'fuzzy-find -t d --exec ~/dev 2'
abbr cde 'fuzzy-find -t d --exec /etc 4'
abbr cdf "fuzzy-find -t d --exec $XDG_DOCUMENTS_DIR/fons 2"
abbr cdk "fuzzy-find -t d --exec $XDG_DOCUMENTS_DIR/vimwiki 2"
abbr cdh 'fuzzy-find -t d --exec ~/hack'
abbr cdj "cd $XDG_DOCUMENTS_DIR/fons/journal"
abbr cdn "cd $XDG_DOCUMENTS_DIR/fons/notes"
abbr cdr "cd $XDG_DOCUMENTS_DIR/fons/review"
abbr cds "cd $XDG_DATA_HOME/myscripts"
abbr cdsys "cd $XDG_CONFIG_HOME/systemd/user"
abbr cdl 'fuzzy-find -t d --exec ~/.local'
abbr cdv 'fuzzy-find -t d --exec ~/vc'
# Dev Playgroud
abbr pg "cd ~/dev/pg && $EDITOR"
# Reload(source) config
# abbr sf "source (fd -HI -t f -e fish . $XDG_CONFIG_HOME/fish)"
abbr sf "source-fish-config"
abbr sff "source-fish-file"
abbr ff 'fuzzy-find -t f'
abbr fe 'fuzzy-find -t f --exec . 5'
abbr ,. 'fuzzy-find -t f --exec . 5'
# Edit config
abbr e. "fuzzy-find -t f --exec $PWD 5"
abbr e~ "fuzzy-find -t f --exec $HOME 7"
abbr ec "fuzzy-find -t f --exec $XDG_CONFIG_HOME 4"
abbr em "$EDITOR $XDG_DOCUMENTS_DIR/morningnote/(date +%Y-%m-%d).md"
abbr eci "$EDITOR $XDG_CONFIG_HOME/i3/config"
abbr ecp "$EDITOR $XDG_CONFIG_HOME/polybar/config"
abbr ew "fuzzy-find -t f --exec $XDG_DOCUMENTS_DIR/vimwiki"
# Edit fish-shell config/func/abbr
abbr ef "fuzzy-find -t f --exec $XDG_CONFIG_HOME/fish 2"
abbr efc "$EDITOR $XDG_CONFIG_HOME/fish/config.fish"
abbr efa "$EDITOR $XDG_CONFIG_HOME/fish/abbreviations.fish"
abbr eff "fuzzy-find -t f --exec $XDG_CONFIG_HOME/fish/functions 1 -E '__*'"
# Create new fish function
abbr nff "new-fish-function"
# Edit vim configs
abbr ev "fuzzy-find -t f --exec $XDG_CONFIG_HOME/nvim 3"
# Edit my own scripts
abbr es "fuzzy-find -t f --exec $XDG_DATA_HOME/myscripts 2"
# Transmission (torrent)
abbr trl "transmission-remote -l"
abbr trc "transmission-remote-cli"
# Git
abbr gs 'git status'
abbr gfe 'git fetch'
abbr gfa 'git fetch --all'
abbr gco 'git checkout'
abbr gcob 'git checkout -b'
abbr gcma 'git commit -am'
abbr gbr 'git branch'
abbr gbra 'git branch -a'
abbr gd 'git diff'
abbr gl 'git log --graph --decorate --oneline --date=iso'
abbr gemp 'git commit --allow-empty -m'
abbr gps "git remote | fzf -1 | xargs -I'{}' git push {}"
abbr gpl "git remote | fzf -1 | xargs -I'{}' git pull {}"
## Use interactive option all time
abbr rm 'rm -i'
abbr rmi 'rm -I'
abbr rmr 'rm -rI'
abbr rmd 'rmdir (fd -t d -t e)'
# abbr for `wishlist` (fish function)
abbr wish 'wishlist'
# Use advcpmv (Advanced cp & mv)
if type -q acp;
abbr cp 'acp -g'
# abbr bk 'acp -g -b'
else
abbr bk 'cp -b'
end
if type -q amv;
abbr mv 'amv -g'
end
## Use modern 'ls' replacement
if type -q exa;
if type -q batexa
abbr la 'batexa -lag --git'
abbr lad 'batexa -lagd --git'
else
abbr la 'exa -lag'
abbr lad 'exa -lagd'
end
abbr we "watchexa"
end
if type -q watchexec;
abbr wax 'watchexec'
end
## Use enhanced 'find'
if type -q fd;
abbr fde 'fd -H -e' # Filter by file extension
abbr fdd 'fd -H -t d' # File type "directory"
abbr fdE 'fd -H -t d -t empty' # File type "directory"
abbr fdf 'fd -H -t f' # File type "file"
abbr fdx 'fd -H -t x' # File type "executable"
abbr fdz "fd -H -t d | xargs -I'{}' zip {} -r {}"
end
if type -q docker;
abbr dockill "docker ps | fzf | awk '{ print $1 }' | xargs -I'{}' docker kill {}"
abbr docrm "docker ps -a | fzf | awk '{ print $1 }' | xargs -I'{}' docker rm {}"
abbr docrmi "docker images | fzf | awk '{ print $1 }' | xargs -I'{}' docker rmi {}"
end
if type -q grc;
abbr blkid 'grc blkid'
abbr cat 'bat'
abbr cpgrep 'colorpgrep'
abbr cvs 'grc cvs'
abbr df 'grc df -h'
abbr diff 'colordiff'
abbr digg 'grc digg'
abbr dnf 'grc dnf'
abbr docker 'grc docker'
abbr du 'grc du'
abbr env 'grc env'
abbr fdisk 'grc fdisk'
abbr findmnt 'grc findmnt'
abbr free 'grc free'
abbr g++ 'grc g++'
abbr gcc 'grc gcc'
abbr getfacl 'grc getfacl'
abbr getsebool 'grc getsebool'
abbr id 'grc id'
abbr iostat 'grc iostat'
# abbr ip 'grc ip'
abbr last 'grc last'
abbr lsattr 'grc lsattr'
abbr lsblk 'grc lsblk'
abbr lsmod 'grc lsmod'
abbr lsof 'grc lsof'
abbr lspci 'grc lspci'
abbr make 'grc make'
abbr mount 'grc mount'
abbr mtr 'grc mtr'
abbr netstat 'grc netstat'
abbr nmap 'grc nmap'
abbr ping 'grc ping -c 3'
abbr ps 'grc ps'
abbr sar 'grc sar'
abbr semanage 'grc semanage'
abbr showmount 'grc showmount'
abbr ss 'grc ss'
abbr stat 'grc stat'
abbr sysctl 'grc sysctl'
abbr tail 'grc tail'
abbr tcpdump 'grc tcpdump'
abbr traceroute 'grc traceroute'
abbr tune2fs 'grc tune2fs'
abbr ulimit 'ulimit'
abbr uptime 'grc uptime'
abbr vmstat 'grc vmstat'
abbr wdiff 'grc wdiff'
end
abbr ip 'ip -color=auto'
# frequently use
abbr ryt 'rsync -aAX --info=progress2 /mnt/hdd/vids/yt/ /mnt/rpi4/vids/yt --delete'
if type -q pueue
abbr ryta 'pueue add -- rsync -aAX --info=progress2 /mnt/hdd/vids/yt/ /mnt/rpi4/vids/yt --delete; pueue add -- rsync -aAX --info=progress2 /mnt/hdd/vids/_archive/ /mnt/rpi4/vids/_archive --delete'
else
abbr ryta 'rsync -aAX --info=progress2 /mnt/hdd/vids/yt/ /mnt/rpi4/vids/yt --delete; rsync -aAX --info=progress2 /mnt/hdd/vids/_archive/ /mnt/rpi4/vids/_archive --delete'
end
abbr pod 'fd -HI -t f --changed-within 30d . ~/.config/mpd/music/rapiko/output/audio | sort | sed "s;/home/inkch/.config/mpd/music/rapiko/output/audio/;;" | fzf | xargs -I'{}' mpc insert rapiko/output/audio/{}'
abbr nndl 'python ~/dev/nndownload/nndownload/nndownload.py -r 10 -u "vfcgxwho@gmail.com" -p "2Mrqxnp*GBHH#6z3e3@BIY!ZzJbcrias"'
# vimwiki
set -l wiki_root $XDG_DOCUMENTS_DIR/vimwiki
abbr ,ww "nvim -c 'cd $wiki_root | Goyo | VimwikiIndex'"
abbr ,wi "nvim -c 'cd $wiki_root | Goyo | VimwikiDiaryIndex'"
abbr ,w,w "nvim -c 'cd $wiki_root | Goyo | VimwikiMakeDiaryNote'"
# Rust
abbr rcr rust-compile-n-run
if type -q nvidia-settings
# nvidia-settings (To use XDG-Base-Directory)
abbr nvidia-settings 'nvidia-settings --config="$XDG_CONFIG_HOME/nvidia/settings"'
end
if type -q insect
abbr calc "insect"
else
abbr calc "echo 'Try `insect`. You can get it fron AUR.'"
end
if type -q z
abbr j "zi"
end
abbr h fiztory
if type -q fzf
abbr sshf "ssh (rg '^Host\s' ~/.ssh/config | cut -d' ' -f 2 | fzf)"
end
if type -q pueue
abbr pu pueue
abbr pus 'pueue status'
abbr pua 'pueue add --'
abbr pul "pueue log (pueue status | rg -o '^\s*[0-9]*\s.*[0-9]' | fzf --multi | cut -d' ' -f 2)"
abbr puf "pueue follow (pueue status | rg -o '^\s*[0-9]*\s.*[0-9]' | fzf --multi | cut -d' ' -f 2)"
abbr puc "pueue clean"
abbr puw "watch -cn 1 'pueue status'"
end
if type -q yarn
abbr ya "yarn --use-yarnrc ~/.config/yarn/yarnrc"
abbr yarn "yarn --use-yarnrc ~/.config/yarn/yarnrc"
end
if type -q vultr-cli
abbr vultr vultr-cli --config $XDG_CONFIG_HOME/vultr-cli/config.yaml
end
if type -q gfold
abbr gf gfold -d classic
end
if type -q zathura
abbr za "zathura (exa ~/dl/pdf | fzf)"
end
# udiskie
if type -q udiskie
abbr udi "udiskie"
end
if type -q udiskie-mount
abbr udim "udiskie-mount"
end
if type -q udiskie-umount
abbr udiu "udiskie-umount"
end
if test -f ~/esp/esp-idf/export.fish
abbr get_idf ". ~/esp/esp-idf/export.fish"
end
if type -q parallel
abbr pa 'parallel'
end
if type -q parallel and type -q aunpack
abbr paun 'parallel aunpack "{}" :::'
end
if type -q mcomix
abbr mx mcomix
end
if type -q chezmoi
abbr cz chezmoi
end