From e2fc1690c87fdf98315baa3aa0f43029f4e7a5bb Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Sun, 20 Mar 2022 21:10:03 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=93=20Adds=20hook=20to=20display=20ali?= =?UTF-8?q?as=20tips=20for=20long=20commands?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsh/aliases/alias-tips.zsh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 zsh/aliases/alias-tips.zsh diff --git a/zsh/aliases/alias-tips.zsh b/zsh/aliases/alias-tips.zsh new file mode 100644 index 0000000..a00fcc0 --- /dev/null +++ b/zsh/aliases/alias-tips.zsh @@ -0,0 +1,14 @@ + +# If an alias for the command just run exists, then show tip +preexec_alias-finder() { + tip=$(alias | grep -E "=$1$") + if [ ! -z "$tip" ]; then + echo -e "\033[0;90m\e[3mTip: \e[4m$tip\033[0m" + fi +} + +# Load add-zsh-hook +autoload -U add-zsh-hook + +# Call function after command +add-zsh-hook preexec preexec_alias-finder \ No newline at end of file