aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/config.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-03-01 20:22:21 +0100
committerGravatar Kurtis Rader <krader@skepticism.us>2016-03-02 10:59:12 -0800
commit0e8a8a7c8023e05792b8b1d32ddbe7bcf2ea3549 (patch)
treefe2e30f064215b870a9367575046bfc919c8e11b /share/config.fish
parentfbd53f2da1af69058b16320265364257a11571df (diff)
Migrate abbrs from =-separated to space-separated
We silently upgrade existing abbreviations and change the separator when saving. This does not yet warn when the user is using the old syntax. Resolves #2051
Diffstat (limited to 'share/config.fish')
-rw-r--r--share/config.fish11
1 files changed, 11 insertions, 0 deletions
diff --git a/share/config.fish b/share/config.fish
index 755cc23e..b7a461c3 100644
--- a/share/config.fish
+++ b/share/config.fish
@@ -165,3 +165,14 @@ for file in $configdir/fish/conf.d/* $__fish_sysconfdir/conf.d/* $__fish_datadir
# This allows one to use e.g. symlinks to /dev/null to "mask" something (like in systemd)
[ -f $file -a -r $file ]; and source $file
end
+
+# Upgrade pre-existing abbreviations from the old "key=value" to the new "key value" syntax
+# This needs to be in share/config.fish because __fish_config_interactive is called after sourcing config.fish, which might contain abbr calls
+if not set -q __fish_init_2_3_0
+ set -l fab
+ for abb in $fish_user_abbreviations
+ set fab $fab (string replace -r '^([^ =]+)=(.*)$' '$1 $2' -- $abb)
+ end
+ set fish_user_abbreviations $fab
+ set -U __fish_init_2_3_0
+end