From 44d5abdc051d42d220254f8b7a167adbefb25c7f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 1 Mar 2025 16:27:59 +0100 Subject: [PATCH] Add back legacy bindings to address modifyOtherKeys regressions in iTerm2<3.5.12 As of 303af07, iTerm2 3.5.11 on two different machines has two different behaviors. For unknown reasons, when pressing alt-right fish_key_reader shows "\e\[1\;9C" on one machine and "\e\[1\;3C" on another. Feels like iTerm2 interprets modifyOtherKeys differently, depending on configuration. We don't want to risk asking for the kitty keyboard protocol until iTerm2 3.5.12 (see https://github.com/fish-shell/fish-shell/issues/11004#issuecomment-2571494782). So let's work around around this weirdness by adding back the legacy bindings removed in c0bcd817ba (Remove obsolete bindings, 2024-04-28) and plan to remove them in a few years. Note that fish_key_reader still reports this as "left", which already has a different binding, but it looks like literal matches of legacy sequences have precedence. Fixes the problem described in https://github.com/fish-shell/fish-shell/issues/11192#issuecomment-2692247060 Closes #11192 --- share/functions/__fish_shared_key_bindings.fish | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/share/functions/__fish_shared_key_bindings.fish b/share/functions/__fish_shared_key_bindings.fish index 448b64441..9b8a3410a 100644 --- a/share/functions/__fish_shared_key_bindings.fish +++ b/share/functions/__fish_shared_key_bindings.fish @@ -56,9 +56,13 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod bind --preset $argv alt-right nextd-or-forward-word bind --preset $argv alt-left prevd-or-backward-word + $legacy_bind --preset $argv \e\[1\;9C nextd-or-forward-word # iTerm2 < 3.5.12 + $legacy_bind --preset $argv \e\[1\;9D prevd-or-backward-word # iTerm2 < 3.5.12 bind --preset $argv alt-up history-token-search-backward bind --preset $argv alt-down history-token-search-forward + $legacy_bind --preset $argv \e\[1\;9A history-token-search-backward # iTerm2 < 3.5.12 + $legacy_bind --preset $argv \e\[1\;9B history-token-search-forward # iTerm2 < 3.5.12 # Bash compatibility # https://github.com/fish-shell/fish-shell/issues/89 bind --preset $argv alt-. history-token-search-backward