7f494944e6e8047b49fdbd42977b4eb4670381fe
- Author
- Marc Cornellà <hello@mcornella.com>
- Committer
- Marc Cornellà <hello@mcornella.com>
- Date
Message
fix(dirhistory): fix ALT+Up/Down key bindings for Terminal.app
Diff
1diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
2index cbac84600283fe79df5f731cbeefdd87d783da22..d949064d8d480bd86fb77da6da82f8905bdd90f8 100644
3--- a/plugins/dirhistory/dirhistory.plugin.zsh
4+++ b/plugins/dirhistory/dirhistory.plugin.zsh
5@@ -121,35 +121,24 @@ function dirhistory_zle_dirhistory_future() {
6 }
7
8 zle -N dirhistory_zle_dirhistory_back
9-# xterm in normal mode
10-bindkey "\e[3D" dirhistory_zle_dirhistory_back
11-bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
12-# Terminal.app
13-if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
14- bindkey "^[b" dirhistory_zle_dirhistory_back
15-fi
16-# iTerm2
17-if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
18- bindkey "^[^[[D" dirhistory_zle_dirhistory_back
19-fi
20-# Putty:
21-bindkey "\e\e[D" dirhistory_zle_dirhistory_back
22-# GNU screen:
23-bindkey "\eO3D" dirhistory_zle_dirhistory_back
24+bindkey "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode
25+bindkey "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode
26+bindkey "\e\e[D" dirhistory_zle_dirhistory_back # Putty
27+bindkey "\eO3D" dirhistory_zle_dirhistory_back # GNU screen
28+case "$TERM_PROGRAM" in
29+iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
30+Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
31+esac
32
33 zle -N dirhistory_zle_dirhistory_future
34-bindkey "\e[3C" dirhistory_zle_dirhistory_future
35-bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
36-# Terminal.app
37-if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
38- bindkey "^[f" dirhistory_zle_dirhistory_future
39-fi
40-# iTerm2
41-if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
42- bindkey "^[^[[C" dirhistory_zle_dirhistory_future
43-fi
44-bindkey "\e\e[C" dirhistory_zle_dirhistory_future
45-bindkey "\eO3C" dirhistory_zle_dirhistory_future
46+bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode
47+bindkey "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode
48+bindkey "\e\e[C" dirhistory_zle_dirhistory_future # Putty
49+bindkey "\eO3C" dirhistory_zle_dirhistory_future # GNU screen
50+case "$TERM_PROGRAM" in
51+iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
52+Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
53+esac
54
55
56 #
57@@ -181,22 +170,21 @@ function dirhistory_zle_dirhistory_down() {
58 }
59
60 zle -N dirhistory_zle_dirhistory_up
61-# xterm in normal mode
62-bindkey "\e[3A" dirhistory_zle_dirhistory_up
63-bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
64-if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
65- bindkey "^[[A" dirhistory_zle_dirhistory_up
66-fi
67-# Putty:
68-bindkey "\e\e[A" dirhistory_zle_dirhistory_up
69-# GNU screen:
70-bindkey "\eO3A" dirhistory_zle_dirhistory_up
71+bindkey "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode
72+bindkey "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode
73+bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty
74+bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen
75+case "$TERM_PROGRAM" in
76+iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
77+Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app
78+esac
79
80 zle -N dirhistory_zle_dirhistory_down
81-bindkey "\e[3B" dirhistory_zle_dirhistory_down
82-bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
83-if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
84- bindkey "^[[B" dirhistory_zle_dirhistory_down
85-fi
86-bindkey "\e\e[B" dirhistory_zle_dirhistory_down
87-bindkey "\eO3B" dirhistory_zle_dirhistory_down
88+bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode
89+bindkey "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode
90+bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty
91+bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen
92+case "$TERM_PROGRAM" in
93+iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
94+Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app
95+esac