dotfiles/config/zsh/aliases/alias-tips.zsh

15 lines
339 B
Bash
Raw Normal View History

# If an alias for the command just run exists, then show tip
preexec_alias-finder() {
2022-10-31 18:20:41 +01:00
tip=$(alias | grep -E "=$1$" | head -1)
if [ ! -z "$tip" ]; then
2022-10-31 18:20:41 +01:00
echo -e "\033[0;90m\e[3mAlias Tip: \e[4m$tip\033[0m"
fi
}
# Load add-zsh-hook
autoload -U add-zsh-hook
# Call function after command
2022-10-31 18:20:41 +01:00
add-zsh-hook preexec preexec_alias-finder