aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-04-12 20:36:46 +0200
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-04-26 15:21:15 +0200
commitf5241da836213b8ee05d4946e4884be2a6714658 (patch)
treed2d0e7d371cd14ed206c7f2b99a1e43e68be2d14 /share/functions
parent8ab980b793e80199f61257b1bc46826a93af8413 (diff)
Let the binding functions set the binding variable
This ensures they can just be called and "the right thing" will happen - fish_user_key_bindings will be executed, the variable will reflect the bindings.
Diffstat (limited to 'share/functions')
-rw-r--r--share/functions/fish_default_key_bindings.fish4
-rw-r--r--share/functions/fish_vi_key_bindings.fish4
2 files changed, 8 insertions, 0 deletions
diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish
index c057754a..e679fac0 100644
--- a/share/functions/fish_default_key_bindings.fish
+++ b/share/functions/fish_default_key_bindings.fish
@@ -1,6 +1,10 @@
function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fish" -a mode
if not set -q mode[1]
+ if test "$fish_key_bindings" != "fish_default_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
bind --erase --all
end
diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish
index c2a40361..1956a11b 100644
--- a/share/functions/fish_vi_key_bindings.fish
+++ b/share/functions/fish_vi_key_bindings.fish
@@ -1,4 +1,8 @@
function fish_vi_key_bindings --description 'vi-like key bindings for fish'
+ if test "$fish_key_bindings" != "fish_vi_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
# be slightly annoying when trying to switch to Vi "normal" mode. Too,
# vi-mode users are unlikely to use escape-as-meta. So set a much shorter