define __fish_active_key_bindings before using it

This commit is contained in:
Kurtis Rader 2017-07-02 13:41:07 -07:00
parent 3284393aba
commit 85b42b22f4
2 changed files with 8 additions and 6 deletions

View file

@ -194,6 +194,7 @@ function __fish_reconstruct_path -d "Update PATH when fish_user_paths changes" -
set local_path $x $local_path
end
end
set -xg PATH $local_path
end

View file

@ -10,6 +10,7 @@ function __fish_config_interactive -d "Initializations that should be performed
end
set -g __fish_config_interactive_done
set -g __fish_active_key_bindings
# Set the correct configuration directory
set -l configdir ~/.config
@ -185,16 +186,16 @@ function __fish_config_interactive -d "Initializations that should be performed
# Reload key bindings when binding variable change
function __fish_reload_key_bindings -d "Reload key bindings when binding variable change" --on-variable fish_key_bindings
# do nothing if the key bindings didn't actually change
# Do nothing if the key bindings didn't actually change.
# This could be because the variable was set to the existing value
# or because it was a local variable
# If fish_key_bindings is empty on the first run, we still need to set the defaults
# or because it was a local variable.
# If fish_key_bindings is empty on the first run, we still need to set the defaults.
if test "$fish_key_bindings" = "$__fish_active_key_bindings" -a -n "$fish_key_bindings"
return
end
# Check if fish_key_bindings is a valid function
# If not, either keep the previous bindings (if any) or revert to default
# Also print an error so the user knows
# Check if fish_key_bindings is a valid function.
# If not, either keep the previous bindings (if any) or revert to default.
# Also print an error so the user knows.
if not functions -q "$fish_key_bindings"
echo "There is no fish_key_bindings function called: '$fish_key_bindings'" >&2
# We need to see if this is a defined function, otherwise we'd be in an endless loop.