From daa217f533490e0b9bc4113a143e8f38de922b7a Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 15 Apr 2016 13:55:19 +0200 Subject: Allow setting key bindings universally As always, we default to setting globally. --- share/functions/fish_default_key_bindings.fish | 4 +++- share/functions/fish_vi_key_bindings.fish | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'share/functions') diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 30529964..3e9fb196 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -2,7 +2,9 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fish" if not set -q argv[1] if test "$fish_key_bindings" != "fish_default_key_bindings" - set -g fish_key_bindings fish_default_key_bindings # This triggers the handler, which calls us again and ensures the user_key_bindings are executed + # Allow the user to set the variable universally + set -q fish_key_bindings; or set -g fish_key_bindings + set fish_key_bindings fish_default_key_bindings # This triggers the handler, which calls us again and ensures the user_key_bindings are executed return end # Clear earlier bindings, if any diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index d46b7ccd..bdb2bd8a 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -1,6 +1,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' if test "$fish_key_bindings" != "fish_vi_key_bindings" - set -g fish_key_bindings fish_vi_key_bindings # This triggers the handler, which calls us again and ensures the user_key_bindings are executed + # Allow the user to set the variable universally + set -q fish_key_bindings; or set -g fish_key_bindings + set fish_key_bindings fish_vi_key_bindings # This triggers the handler, which calls us again and ensures the user_key_bindings are executed return end # The default escape timeout is 300ms. But for users of Vi bindings that can -- cgit v1.2.3