浏览代码

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

Fixes #11026
Fixes #11407
Marc Cornellà 1 月之前
父节点
当前提交
068299685c
共有 1 个文件被更改,包括 8 次插入2 次删除
  1. 8 2
      plugins/dirhistory/dirhistory.plugin.zsh

+ 8 - 2
plugins/dirhistory/dirhistory.plugin.zsh

@@ -136,8 +136,11 @@ for keymap in emacs vicmd viins; do
 
   case "$TERM_PROGRAM" in
   Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
-  iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;;   # iTerm2
   ghostty) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;;        # ghostty
+  iTerm.app)
+    bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back
+    bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back
+    ;;
   esac
 
   if (( ${+terminfo[kcub1]} )); then
@@ -152,8 +155,11 @@ for keymap in emacs vicmd viins; do
 
   case "$TERM_PROGRAM" in
   Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
-  iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;;   # iTerm2
   ghostty) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;;        # ghostty
+  iTerm.app)
+    bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future
+    bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future
+    ;;
   esac
 
   if (( ${+terminfo[kcuf1]} )); then