From 2646d51a0bb2551e1d53d164cea2a6a15be44b6e Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sun, 31 Jan 2016 17:37:51 -0800 Subject: change default escape timeout This changes the default escape timeout for the default keybindings (emacs mode) to 300ms and the default for vi keybindings to 10ms. I couldn't resist fixing a few nits in the fish_vi_key_bindings.fish file since I was touching it to set the escape timeout. --- share/functions/fish_vi_key_bindings.fish | 32 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'share/functions/fish_vi_key_bindings.fish') diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 98f2ca12..a1496b80 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -1,29 +1,29 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' - bind --erase --all + # 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 + # timeout in this case. + set -q fish_escape_delay_ms; or set -g fish_escape_delay_ms 10 + set -l init_mode insert if set -q argv[1] set init_mode $argv[1] end - # Inherit default key bindings - # Do this first so vi-bindings win over default + # Inherit default key bindings. + # Do this first so vi-bindings win over default. + bind --erase --all fish_default_key_bindings -M insert fish_default_key_bindings -M default - # Add a way to get out of insert mode + # Add a way to switch from insert to normal (command) mode. bind -M insert -m default \cc force-repaint bind -M insert -m default \e backward-char force-repaint - ## - ## command mode - ## - - bind :q exit - # - # normal (default) mode + # normal (command) mode # - + bind :q exit bind \cd exit bind \cc 'commandline ""' bind h backward-char @@ -128,9 +128,9 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -m insert cge backward-kill-word force-repaint bind -m insert cgE backward-kill-bigword force-repaint - bind '~' capitalize-word - bind gu downcase-word - bind gU upcase-word + bind '~' capitalize-word + bind gu downcase-word + bind gU upcase-word bind J end-of-line delete-char bind K 'man (commandline -t) ^/dev/null; or echo -n \a' @@ -172,7 +172,6 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' # # Lowercase r, enters replace-one mode # - bind -m replace-one r force-repaint bind -M replace-one -m default '' delete-char self-insert backward-char force-repaint bind -M replace-one -m default \e cancel force-repaint @@ -180,7 +179,6 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' # # visual mode # - bind -M visual \e\[C forward-char bind -M visual \e\[D backward-char bind -M visual -k right forward-char -- cgit v1.2.3