diff options
author | Roger Gonzalez <roger@rogs.me> | 2023-03-18 16:40:57 -0300 |
---|---|---|
committer | Roger Gonzalez <roger@rogs.me> | 2023-03-18 16:40:57 -0300 |
commit | 8600374371f91843064441113f4023cda1730877 (patch) | |
tree | bb4677ec186dd5c323f1f010207076b7df285606 /.config/fish/functions/__abbr_tips_init.fish | |
parent | c95dd49df12f4f8dc13cf3bdc4dad70a060bd5eb (diff) |
General fish fixes and updates
Diffstat (limited to '.config/fish/functions/__abbr_tips_init.fish')
-rw-r--r-- | .config/fish/functions/__abbr_tips_init.fish | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/fish/functions/__abbr_tips_init.fish b/.config/fish/functions/__abbr_tips_init.fish new file mode 100644 index 00000000..9cda53ad --- /dev/null +++ b/.config/fish/functions/__abbr_tips_init.fish @@ -0,0 +1,24 @@ +function __abbr_tips_init -d "Initialize abbreviations variables for fish-abbr-tips" + set -e __ABBR_TIPS_KEYS + set -e __ABBR_TIPS_VALUES + set -Ux __ABBR_TIPS_KEYS + set -Ux __ABBR_TIPS_VALUES + + set -l i 1 + set -l abb (string replace -r '.*-- ' '' -- (abbr -s)) + while test $i -le (count $abb) + set -l current_abb (string split -m1 -- ' ' "$abb[$i]") + set -a __ABBR_TIPS_KEYS "$current_abb[1]" + set -a __ABBR_TIPS_VALUES (string trim -c '\'' -- "$current_abb[2]") + set i (math $i + 1) + end + + set -l i 1 + set -l abb (string replace -r '.*-- ' '' -- (alias -s)) + while test $i -le (count $abb) + set -l current_abb (string split -m2 -- ' ' "$abb[$i]") + set -a __ABBR_TIPS_KEYS "a__$current_abb[2]" + set -a __ABBR_TIPS_VALUES (string trim -c '\'' -- "$current_abb[3]") + set i (math $i + 1) + end +end |