dotfiles/home/default/.config/shell/aliasrc
2023-05-04 13:24:10 +07:00

67 lines
1.9 KiB
Bash

#!/bin/sh
# Use neovim for vim if present.
[ -x "$(command -v nvim)" ] && alias vim="nvim" vimdiff="nvim -d"
# Use $XINITRC variable if file exists.
[ -f "$XINITRC" ] && alias startx="startx $XINITRC"
# sudo not required for some system commands
for command in mount umount sv pacman updatedb su shutdown poweroff reboot ; do
alias $command="sudo $command"
done; unset command
se() { cd ~/.local/bin; $EDITOR $(fzf) ;}
# Verbosity and settings that you pretty much just always are going to want.
alias \
cp="cp -iv" \
mv="mv -iv" \
rm="rm -vI" \
bc="bc -ql" \
pg="ps -aux | grep --color=auto" \
mkd="mkdir -pv" \
ffmpeg="ffmpeg -hide_banner"
wedit(){
which $@ >/dev/null 2>&1 && [ -n "$1" ] && vim $(which $@) && exit 0
printf "file doesn't exist.\n"
}
# Colorize commands when possible.
alias \
ls="ls -hN --color=auto --group-directories-first" \
grep="grep --color=auto" \
diff="diff --color=auto" \
ccat="highlight --out-format=ansi" \
ip="ip -color=auto"
# These common commands are just too long! Abbreviate them.
alias \
ka="killall" \
g="git" \
sdn="shutdown -h now" \
e="$EDITOR" \
v="nvim" \
z="zathura" \
i="nsxiv -a"
alias \
magit="nvim -c MagitOnly" \
ref="shortcuts >/dev/null; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/shortcutrc ; source ${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshnameddirrc" \
weath="curl wttr.in"
# misc
alias \
ytmus="yt-dlp --embed-metadata --embed-thumbnail -xc -f bestaudio/best --restrict-filenames" \
ytvid="yt-dlp --embed-metadata --embed-thumbnail --embed-chapters --write-auto-subs -f bestvideo'[height<=1080]''[ext=mp4]'+bestaudio'[ext=m4a]'/best'[ext=mp4]'/best" \
t="todo.sh -t -d $HOME/notebook/todo/todo.cfg" \
fj="firejail --profile=$HOME/.config/firejail/game.profile" \
dj="dijo"
# ytfzf
alias \
ytfzf="ytfzf --thumb-viewer=imv" \
ytfzf-video="ytfzf --detach -t" \
ytfzf-audio="ytfzf -m" \
ytfzf-history="ytfzf --detach -H"