Add $__fish_config_dir variable

Contains the path to the user config.fish (e.g. ~/.config/fish)
without having to do the `set -q XDG_CONFIG_HOME` dance.

See #5270.
This commit is contained in:
Fabian Homborg
2018-10-21 15:42:25 +02:00
parent 162af88c9a
commit 6c988abe28
3 changed files with 9 additions and 14 deletions

View File

@@ -8,12 +8,7 @@ function funcsave --description "Save the current definition of all specified fu
return 0
end
set -l configdir ~/.config
if set -q XDG_CONFIG_HOME
set configdir $XDG_CONFIG_HOME
end
if not mkdir -p $configdir/fish/functions
if not mkdir -p $__fish_config_dir/functions
printf (_ "%s: Could not create configuration directory\n") funcsave
return 1
end
@@ -21,7 +16,7 @@ function funcsave --description "Save the current definition of all specified fu
set -l retval 0
for funcname in $argv
if functions -q -- $funcname
functions -- $funcname >$configdir/fish/functions/$funcname.fish
functions -- $funcname >$__fish_config_dir/functions/$funcname.fish
else
printf (_ "%s: Unknown function '%s'\n") funcsave $funcname
set retval 1