From ca13e816cef35d7cec70d2ba899bd2d5911a87d0 Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 1 Apr 2018 16:11:12 -0700 Subject: [PATCH] Make fish more resilient to empty key bindings If fish_key_bindings gets set to empty, fish will become unusable. In this case reset it to fish_default_key_bindings. --- share/functions/__fish_config_interactive.fish | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_config_interactive.fish b/share/functions/__fish_config_interactive.fish index 7f0a0a6a4..59b52f4b6 100644 --- a/share/functions/__fish_config_interactive.fish +++ b/share/functions/__fish_config_interactive.fish @@ -188,13 +188,14 @@ function __fish_config_interactive -d "Initializations that should be performed complete -x -p "/etc/init.d/*" -a reload --description 'Reload service configuration' end - # Make sure some key bindings are set - if not set -q fish_key_bindings - set -U fish_key_bindings fish_default_key_bindings - end # 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 + # Make sure some key bindings are set + if not set -q fish_key_bindings + set -U fish_key_bindings fish_default_key_bindings + end + # 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. @@ -297,7 +298,8 @@ function __fish_config_interactive -d "Initializations that should be performed # First check if we are on OpenSUSE since SUSE's handler has no options # but the same name and path as Ubuntu's. - if contains -- suse $os; or contains -- sles $os + if contains -- suse $os + or contains -- sles $os and type -q command-not-found function __fish_command_not_found_handler --on-event fish_command_not_found /usr/bin/command-not-found $argv[1]