Collection of configuration files
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dotfiles/dot_config/zsh/rc.d/95-aliases.zsh.tmpl

92 lines
3.0 KiB

#!/usr/bin/env zsh
# Enable pasting code into the terminal without the shell complaining about\
# the pasted prompt symbols
alias %= \$=
# zmv lets you batch rename (or copy or link) files by using pattern matching.
# https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#index-zmv
autoload -Uz zmv
alias zmv='zmv -Mv'
alias zcp='zmv -Cv'
alias zln='zmv -Lv'
alias e='${(z)VISUAL:-${(z)EDITOR}}'
alias type='type -a'
alias cp="${aliases[cp]:-cp} -i"
alias ln="${aliases[ln]:-ln} -i"
alias mv="${aliases[mv]:-mv} -i"
alias rm="${aliases[rm]:-rm} -i"
# ls
alias sl='ls' # Correction for common spelling error.
if (( $+commands[exa] )); then
alias ls="${aliases[ls]:-exa}"
alias l='ls --oneline --all' # one column, + hidden files.
alias ll='ls --long --header' # long format
alias lr='ll --recurse' # human readable sizes, recursively.
alias la='ll --all' # long format, + hidden files.
alias lm='la | "$PAGER"' # long format, + hidden files, through pager.
alias lk='ll --sort=size' # sorted by size (largest last)
alias lt='ll --sort=modified' # sorted by date (most recent last)
alias lc='lt --changed' # sorted by date (most recent last) + ctime.
alias lu='lt --accessed' # sorted by date (most recent last) + atime.
alias lg='la --git' # long format, + hidden files, + Git status
alias lx='ll --sort=extension' # sorted by extension
fi
# tree
alias tree='ls --tree'
{{ if (eq .chezmoi.os "darwin") }}
alias o='open'
{{ else if (eq .chezmoi.os "windows" ) }}
if [[ "$OSTYPE" == cygwin* ]]; then
alias o='cygstart'
alias pbcopy='tee > /dev/clipboard'
alias pbpaste='cat /dev/clipboard'
fi
{{ else if (eq .chezmoi.os "android" ) }}
alias o='termux-open'
alias pbcopy='termux-clipboard-set'
alias pbpaste='termux-clipboard-get'
{{ else }}
alias o='xdg-open'
if (( $+commands[xclip] )); then
alias pbcopy='xclip -selection clipboard -in'
alias pbpaste='xclip -selection clipboard -out'
elif (( $+commands[xsel] )); then
alias pbcopy='xsel --clipboard --input'
alias pbpaste='xsel --clipboard --output'
fi
{{ end }}
# Archives
alias mktar='gtar --create'
alias untar='gtar --extract -f'
alias mktgz='gtar --create --gzip'
alias mktbz2='gtar --create --bzip2'
alias mktxz='gtar --create --xz'
# Git
_git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B'
_git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n'
_git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n'
alias code=codium
alias lg=lazygit
alias sccc='scc --no-cocomo -c --no-min-gen'
# VPN configs
alias vpn-tubs='sudo openconnect -u y0100973 --authgroup=Tunnel-TU-Traffic --passwd-on-stdin vpngate.tu-bs.de < ~/.config/openconnect/tubs.passwd'
alias b='buku --suggest'
[[ "$TERM" == "xterm-kitty" ]] && alias ssh='kitty +kitten ssh'
(( $+commands[shred] )) && alias obliterate='shred --remove'