068299685ceac5af570232ca5daa0ecd4d1f7d62

Author
Marc Cornellà <marc@mcornella.com>
Committer
Marc Cornellà <marc@mcornella.com>
Date

Message

fix(dirhistory): support iTerm2 natural text key bindings (#11026)

Fixes #11026
Fixes #11407

Diff

 1diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
 2index 8d66de7f54c5238ab1e7d021aa53bde9d16785f2..4650666be166ba158becc9b64f748fd6cf992d46 100644
 3--- a/plugins/dirhistory/dirhistory.plugin.zsh
 4+++ b/plugins/dirhistory/dirhistory.plugin.zsh
 5@@ -136,8 +136,11 @@ for keymap in emacs vicmd viins; do
 6 
 7   case "$TERM_PROGRAM" in
 8   Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
 9-  iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;;   # iTerm2
10   ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;;        # ghostty
11+  iTerm.app)
12+    bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
13+    bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
14+    ;;
15   esac
16 
17   if (( ${+terminfo[kcub1]} )); then
18@@ -152,8 +155,11 @@ for keymap in emacs vicmd viins; do
19 
20   case "$TERM_PROGRAM" in
21   Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
22-  iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;;   # iTerm2
23   ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;;        # ghostty
24+  iTerm.app)
25+    bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
26+    bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
27+    ;;
28   esac
29 
30   if (( ${+terminfo[kcuf1]} )); then