From 30564fed28926a63afd064392493ed9abd7f6c30 Mon Sep 17 00:00:00 2001 From: Gazorby Date: Mon, 13 Apr 2020 19:56:04 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor(improvment):=20on?= =?UTF-8?q?e=20word=20matching?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.d/abbr_tips.fish | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf.d/abbr_tips.fish b/conf.d/abbr_tips.fish index cb65920..a704ec9 100644 --- a/conf.d/abbr_tips.fish +++ b/conf.d/abbr_tips.fish @@ -35,8 +35,9 @@ function abbr_fish --on-event fish_postexec -d "Abbreviation reminder for the cu # - Finally trey with the first three words (ex : docker volume rm myvolume => docker volume rm) if set -l abb (contains -i -- "$cmd" $_ABBR_TIPS_VALUES) or set -l abb (contains -i -- (string replace -r -a '((-{1,2})\\w+)(\\s\\S+)' '$1' "$cmd") $_ABBR_TIPS_VALUES) - or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){2}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES) or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){3}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES) + or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){2}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES) + or set -l abb (contains -i -- (string replace -r -a '(^( ?\\w+){1}).*' '$1' "$cmd") $_ABBR_TIPS_VALUES) echo -e (string replace -a '{{ .cmd }}' "$_ABBR_TIPS_VALUES[$abb]" \ (string replace -a '{{ .abbr }}' "$_ABBR_TIPS_KEYS[$abb]" "$ABBR_TIPS_PROMPT")) return