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
This commit is contained in:
Fabian Homborg
2016-03-01 20:22:21 +01:00
committed by Kurtis Rader
parent fbd53f2da1
commit 0e8a8a7c80
3 changed files with 23 additions and 15 deletions

View File

@@ -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