From d37e7bcc259877d2098ea09deccd0926bde81e80 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Sun, 15 Jan 2017 11:11:38 -0800 Subject: [PATCH] reinstate some bindings for vi mode Fixes #3731 --- share/functions/__fish_shared_key_bindings.fish | 3 +++ share/functions/fish_default_key_bindings.fish | 4 +--- share/functions/fish_vi_key_bindings.fish | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index b011a9241..9230c60a9 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -22,6 +22,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind $argv \eOC forward-char bind $argv \eOD backward-char + bind $argv -k ppage beginning-of-history + bind $argv -k npage end-of-history + # Interaction with the system clipboard. bind $argv \cx fish_clipboard_copy bind $argv \cv fish_clipboard_paste diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index bf99c5d6d..008b183cb 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -51,7 +51,7 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis # OS X SnowLeopard doesn't have these keys. Don't show an annoying error message. bind $argv -k home beginning-of-line 2>/dev/null bind $argv -k end end-of-line 2>/dev/null - bind $argv \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-delete + bind $argv \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-ctrl-delete bind $argv \ca beginning-of-line bind $argv \ce end-of-line @@ -72,8 +72,6 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis bind $argv \ef forward-word bind $argv \e\[1\;5C forward-word bind $argv \e\[1\;5D backward-word - bind $argv -k ppage beginning-of-history - bind $argv -k npage end-of-history bind $argv \e\< beginning-of-buffer bind $argv \e\> end-of-buffer diff --git a/share/functions/fish_vi_key_bindings.fish b/share/functions/fish_vi_key_bindings.fish index b6a7da30b..51d8adebf 100644 --- a/share/functions/fish_vi_key_bindings.fish +++ b/share/functions/fish_vi_key_bindings.fish @@ -110,10 +110,17 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind e forward-char forward-word backward-char bind E forward-bigword backward-char - bind x delete-char - bind X backward-delete-char + # OS X SnowLeopard doesn't have these keys. Don't show an annoying error message. + # Vi/Vim doesn't support these keys in insert mode but that seems silly so we do so anyway. + bind -M insert -k home beginning-of-line 2>/dev/null + bind -M default -k home beginning-of-line 2>/dev/null + bind -M insert -k end end-of-line 2>/dev/null + bind -M default -k end end-of-line 2>/dev/null - bind -k dc delete-char + bind -M default x delete-char + bind -M default X backward-delete-char + bind -M insert -k dc delete-char + bind -M default -k dc delete-char # Backspace deletes a char in insert mode, but not in normal/default mode. bind -M insert -k backspace backward-delete-char @@ -122,7 +129,8 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish' bind -M default \ch backward-char bind -M insert \x7f backward-delete-char bind -M default \x7f backward-char - bind \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-delete + bind -M insert \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-ctrl-delete + bind -M default \e\[3\;2~ backward-delete-char # Mavericks Terminal.app shift-ctrl-delete bind dd kill-whole-line bind D kill-line