Skip to content

Commit 6ad9a9c

Browse files
committed
clarify logic, fix EXPAND option when used with REVEAL
1 parent d902e86 commit 6ad9a9c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

alias-tips.plugin.zsh

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ fi
1212
#export ZSH_PLUGINS_ALIAS_TIPS_EXPAND=0
1313

1414
_alias_tips__preexec () {
15-
if [[ $1 != $2 ]] then # Alias is used
16-
if [[ ${ZSH_PLUGINS_ALIAS_TIPS_REVEAL-0} == 1 ]] then # Reveal aliased command
17-
if [[ ${${ZSH_PLUGINS_ALIAS_TIPS_REVEAL_EXCLUDES-()}[(I)$1]} != 0 ]] then # Exit
18-
return 0
19-
fi
20-
local reveal_text=${ZSH_PLUGINS_ALIAS_TIPS_REVEAL_TEXT-${ZSH_PLUGINS_ALIAS_TIPS_TEXT-Alias tip: }}
21-
local color_dark_gray='\e[1;30m'
22-
local color_reset='\e[0m'
23-
echo -e "$color_dark_gray$reveal_text$2 $color_reset"
15+
local CMD=$1
16+
local CMD_EXPANDED=$2
17+
if [[ $CMD != $CMD_EXPANDED ]] then # Alias is used
18+
if [[ ${ZSH_PLUGINS_ALIAS_TIPS_REVEAL-0} == 1 ]] \
19+
&& [[ ${${ZSH_PLUGINS_ALIAS_TIPS_REVEAL_EXCLUDES-()}[(I)$1]} == 0 ]] then # Reveal cmd
20+
local reveal_text=${ZSH_PLUGINS_ALIAS_TIPS_REVEAL_TEXT-Alias for: }
21+
local color_dark_gray='\e[1;30m'
22+
local color_reset='\e[0m'
23+
echo -e "$color_dark_gray$reveal_text$CMD_EXPANDED $color_reset"
24+
fi
25+
if [[ ${ZSH_PLUGINS_ALIAS_TIPS_EXPAND-1} == 0 ]] then
26+
return 0
2427
fi
25-
return 0
2628
fi
2729

2830
if hash git 2> /dev/null; then

0 commit comments

Comments
 (0)