diff options
author | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-04 13:56:06 -0800 |
---|---|---|
committer | ridiculousfish <corydoras@ridiculousfish.com> | 2016-02-04 13:56:49 -0800 |
commit | 25ad8866c97b242911b1e52298c8cfeed4530097 (patch) | |
tree | 8043d99a119ecef9bef288d9c77be9324898af80 /share/functions | |
parent | 1d446b74ffb563ee18c298417b802458aad9ca84 (diff) | |
parent | 2646d51a0bb2551e1d53d164cea2a6a15be44b6e (diff) |
Merge change for lengthened and configurable escape key timeout
Diffstat (limited to 'share/functions')
-rw-r--r-- | share/functions/fish_vi_key_bindings.fish | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 70f88d8b..5debe616 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -1,5 +1,10 @@ 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 set -l eol_keys \$ g\$ \e\[F set -l bol_keys \^ 0 g\^ \e\[H @@ -7,25 +12,20 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' 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 @@ -129,9 +129,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' @@ -173,7 +173,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 @@ -181,7 +180,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 |