From e81d3005c53129a8b3112f7dbadbf137c4017234 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Mon, 24 Apr 2023 11:50:52 +0200 Subject: [PATCH] zsh:alias: Manually expand aliases anywhere When passing a full command as arguments to another (e.g. `sudo`), aliases are not expanded. Add the `$` alias that makes it possible to expand a following alias anywhere. This uses the feature that aliases ending in a space will trigger alias expansion on the next argument. See: https://unix.stackexchange.com/a/433849 --- .config/zsh/zshrc.d/30-alias.zsh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.config/zsh/zshrc.d/30-alias.zsh b/.config/zsh/zshrc.d/30-alias.zsh index d8e970f..e8d995a 100644 --- a/.config/zsh/zshrc.d/30-alias.zsh +++ b/.config/zsh/zshrc.d/30-alias.zsh @@ -55,6 +55,9 @@ fi alias -g no1='>/dev/null' alias -g no2='2>/dev/null' alias -g noO='&>/dev/null' + # Manually trigger alias expansion for the next word + # Taken from https://unix.stackexchange.com/a/433849 + alias -g '$= ' # Git alias g='git'