From 7167ba6e085ff4cedc218c0ad902c442c9171389 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Fri, 23 Jul 2021 19:38:43 +0200 Subject: [PATCH] Work around Terminal.app's awkward alt-left/right sequences Just do the more involved thing. Blergh. Fixes #2330. --- share/functions/fish_default_key_bindings.fish | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/share/functions/fish_default_key_bindings.fish b/share/functions/fish_default_key_bindings.fish index 4f28ded5c..2d4195c4b 100644 --- a/share/functions/fish_default_key_bindings.fish +++ b/share/functions/fish_default_key_bindings.fish @@ -91,8 +91,16 @@ function fish_default_key_bindings -d "Default (Emacs-like) key bindings for fis # One of these is alt+backspace. bind --preset $argv \e\x7f backward-kill-word bind --preset $argv \e\b backward-kill-word - bind --preset $argv \eb backward-word - bind --preset $argv \ef forward-word + if not test "$TERM_PROGRAM" = Apple_Terminal + bind --preset $argv \eb backward-word + bind --preset $argv \ef forward-word + else + # Terminal.app sends \eb for alt+left, \ef for alt+right. + # Yeah. + bind --preset $argv \eb prevd-or-backward-word + bind --preset $argv \ef nextd-or-forward-word + end + bind --preset $argv \e\< beginning-of-buffer bind --preset $argv \e\> end-of-buffer