dotfiles/zsh/.config/zsh/aliases.zsh
2023-05-11 20:12:15 +02:00

94 lines
2.5 KiB
Bash

# File management
alias cp="cp -i"
alias mv="mv -i"
alias rm="rm -i"
alias rmf="rm -rf"
alias mkdir="mkdir -p"
# Navigation
alias -g ...="../.."
alias -g ....="../../.."
alias -g .....="../../../.."
alias -g ......="../../../../.."
# ls'ing
alias ls="ls --color=always"
(( ${+commands[exa]} )) && {
alias exa="exa -Fh --color=always --git --icons"
alias la="exa -l"
alias l="exa -al"
alias ll="exa -aagl@"
alias lag="la --git-ignore"
alias lg="l --git-ignore"
alias llg="ll --git-ignore"
alias t="exa --tree -I '.git|node_modules'"
alias tl="t -l"
alias tla="tl -a"
alias tlaa="tla -g@"
}
# Git
(( ${+commands[git]} )) && {
alias gi="git init"
alias gsa="git submodule add"
alias gsur="git submodule update --remote"
}
# Vagrant
(( ${+commands[vagrant]} )) && {
alias vagrant-scp="scp -F =(vagrant ssh-config) -i =(ssh-add -L)"
alias vagrant-ssh="ssh -F =(vagrant ssh-config) -i =(ssh-add -L)"
}
# Filesystems
alias lsblk="lsblk -o name,mountpoint,size,label,uuid"
(( ${+commands[udisksctl]} )) && {
alias lock="udisksctl lock -b"
alias mount="udisksctl mount -b"
alias unlock="udisksctl unlock -b"
alias unmount="udisksctl unmount -b"
}
# Searching
alias grep="grep --color=always"
alias zgrep="zgrep --color=always"
(( ${+commands[rg]} )) &&
alias rgh="rg --hidden -g '!/.git/'"
# Misc.
alias cl="clear"
alias e="\$EDITOR"
alias se="sudoedit"
alias q="exit 0"
alias visudo="sudo EDITOR=\"rvim -nc 'set nobackup nowritebackup'\" visudo"
(( ${+commands[tmux]} )) &&
alias tmux="tmux -2u"
(( ${+commands[dotnet]} )) &&
alias dnup="dotnet tool list --global | tail -n +3 | awk '{print \$1}' | xargs -l dotnet tool update --global"
(( ${+commands[bat]} )) && {
alias pbat="bat -pp"
alias bless="bat -p --paging=always"
alias nbless="bat --paging=always"
}
# Platform specific
if [[ $(. /etc/os-release && echo $ID) == "artix" ]]; then
alias code="codium --enable-features=UseOzonePlatform --ozone-platform=wayland"
alias pacin="sudo pacman -S"
alias pacls="pacman -Qkl"
alias pacown="pacman -Qo"
alias pacqi="pacman -Qi"
alias pacqs="pacman -Qs"
alias pacrm="sudo pacman -Rcsu"
alias pacsi="pacman -Si"
alias pacss="pacman -Ss"
elif [[ $(. /etc/os-release && echo $ID) == "fedora" ]]; then
alias code="codium"
alias dnfin="sudo dnf install"
alias dnfqi="rpm -qi"
alias dnfqs="rpm -qa"
alias dnfrm="sudo dnf remove"
alias dnfsi="sudo dnf info"
alias dnfss="sudo dnf search"
fi