zsh: add some suffix aliases

Aliases that run when files of a matching type are opened.

See https://youtu.be/8CZIv3MJvic?si=QVqtaCDNaygs2qaE&t=670.
This commit is contained in:
Oliver Davies 2024-08-19 22:18:02 +01:00
parent c712a1b254
commit b30909b32a

View file

@ -13,6 +13,19 @@
};
initExtra = ''
# suffix
alias -s gz="tar -tf"
alias -s {html,HTML}="background firefox"
alias -s {jpg,JPG,png,PNG}="background okular"
alias -s {pdf,PDF}="background okular"
alias -s {zip,ZIP}="unzip -l"
background() {
for ((i=2;i<=$#;i++)); do
''${@[1]} ''${@[$i]} &> /dev/null &
done
}
git() {
if [[ "''${1}" == "root" ]]; then
shift