From 1bc887cd9f0e4ce1caeeef7737eb9ee163e2b6d4 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sat, 3 Sep 2016 19:27:42 +0200 Subject: [PATCH] Vi-mode: Also share end/home bindings Fixes #3298. --- share/functions/__fish_shared_key_bindings.fish | 3 +++ share/functions/fish_default_key_bindings.fish | 3 --- share/functions/fish_vi_key_bindings.fish | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 49b7db51c..5e23d890d 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -74,6 +74,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind $argv \cc __fish_cancel_commandline bind $argv \cu backward-kill-line bind $argv \cw backward-kill-path-component + bind $argv \e\[F end-of-line + bind $argv \e\[H beginning-of-line + bind $argv \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end' bind $argv \cd delete-or-exit diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 6d1e4bb19..db7bb971e 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -33,9 +33,6 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis bind $argv -k backspace backward-delete-char bind $argv \x7f backward-delete-char - bind $argv \e\[H beginning-of-line - bind $argv \e\[F end-of-line - # for PuTTY # https://github.com/fish-shell/fish-shell/issues/180 bind $argv \e\[1~ beginning-of-line diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index 28231ed9f..cc8e675b3 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -18,8 +18,10 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' set -q fish_escape_delay_ms; or set -g fish_escape_delay_ms 100 set -l init_mode insert - set -l eol_keys \$ g\$ \e\[F - set -l bol_keys \^ 0 g\^ \e\[H + # These are only the special vi-style keys + # not end/home, we share those. + set -l eol_keys \$ g\$ + set -l bol_keys \^ 0 g\^ if set -q argv[1] set init_mode $argv[1] end