Skip to content

Commit 59e90e2

Browse files
committed
🐛 fix: properly resetting abbr status
1 parent 46c70c1 commit 59e90e2

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

conf.d/abbr_tips.fish

+5-8
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,13 @@ function abbr_fish --on-event fish_postexec -d "Abbreviation reminder for the cu
1010
set -l command (string split ' ' "$argv")
1111
set -l cmd (string replace -r -a '\\s+' ' ' "$argv" )
1212

13-
# Exit if either command is already an abbreviation
14-
# or not found
15-
# or it's a function
16-
if abbr -q "$cmd"
13+
if test $_abbr_tips_is_abbr = 1
14+
set -g _abbr_tips_is_abbr 0
15+
return
16+
else if abbr -q "$cmd"
1717
or ! type -q "$command[1]"
18-
or test $_abbr_tips_is_abbr = 1
1918
return
20-
end
21-
if test (type -t "$command[1]") = 'function'
19+
else if test (type -t "$command[1]") = 'function'
2220
and ! contains "$command[1]" $ABBR_TIPS_ALIAS_WHITELIST
2321
return
2422
end
@@ -32,7 +30,6 @@ function abbr_fish --on-event fish_postexec -d "Abbreviation reminder for the cu
3230
or set -l abb (contains -i -- (string replace -r -a '((-{1,2})\\w+)(\\s\\S+)' '$1' "$cmd") $_ABBR_TIPS_VALUES)
3331
or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){2}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES)
3432
or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){3}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES)
35-
set -g _abbr_tips_is_abbr 0
3633
echo -e "\n💡 \e[1m$_ABBR_TIPS_KEYS[$abb]\e[0m => $_ABBR_TIPS_VALUES[$abb]"
3734
return
3835
end

0 commit comments

Comments
 (0)