Diff
1diff --git a/plugins/dirhistory/dirhistory.plugin.zsh b/plugins/dirhistory/dirhistory.plugin.zsh
2index d949064d8d480bd86fb77da6da82f8905bdd90f8..26ef074943acbb00a51b4803dacf676e9f3960bd 100644
3--- a/plugins/dirhistory/dirhistory.plugin.zsh
4+++ b/plugins/dirhistory/dirhistory.plugin.zsh
5@@ -1,7 +1,7 @@
6-##
7-# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
8+##
9+# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
10 # that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
11-#
12+#
13 # Navigate directory hierarchy using ALT-UP and ALT-DOWN.
14 # ALT-UP moves to higher hierarchy (cd ..)
15 # ALT-DOWN moves into the first directory found in alphabetical order
16@@ -14,8 +14,8 @@ export dirhistory_future
17
18 export DIRHISTORY_SIZE=30
19
20-# Pop the last element of dirhistory_past.
21-# Pass the name of the variable to return the result in.
22+# Pop the last element of dirhistory_past.
23+# Pass the name of the variable to return the result in.
24 # Returns the element if the array was not empty,
25 # otherwise returns empty string.
26 function pop_past() {
27@@ -32,7 +32,7 @@ function pop_future() {
28 fi
29 }
30
31-# Push a new element onto the end of dirhistory_past. If the size of the array
32+# Push a new element onto the end of dirhistory_past. If the size of the array
33 # is >= DIRHISTORY_SIZE, the array is shifted
34 function push_past() {
35 if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then
36@@ -76,7 +76,7 @@ function dirhistory_back() {
37 local d=""
38 # Last element in dirhistory_past is the cwd.
39
40- pop_past cw
41+ pop_past cw
42 if [[ "" == "$cw" ]]; then
43 # Someone overwrote our variable. Recover it.
44 dirhistory_past=($PWD)
45@@ -129,6 +129,9 @@ case "$TERM_PROGRAM" in
46 iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
47 Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
48 esac
49+if (( ${+terminfo[kcub1]} )); then
50+ bindkey "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt
51+fi
52
53 zle -N dirhistory_zle_dirhistory_future
54 bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode
55@@ -139,11 +142,14 @@ case "$TERM_PROGRAM" in
56 iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
57 Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
58 esac
59+if (( ${+terminfo[kcuf1]} )); then
60+ bindkey "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt
61+fi
62
63
64-#
65+#
66 # HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
67-#
68+#
69
70 # Move up in hierarchy
71 function dirhistory_up() {
72@@ -178,6 +184,9 @@ case "$TERM_PROGRAM" in
73 iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
74 Apple_Terminal) bindkey "^[OA" dirhistory_zle_dirhistory_up ;; # Terminal.app
75 esac
76+if (( ${+terminfo[kcuu1]} )); then
77+ bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt
78+fi
79
80 zle -N dirhistory_zle_dirhistory_down
81 bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode
82@@ -188,3 +197,6 @@ case "$TERM_PROGRAM" in
83 iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
84 Apple_Terminal) bindkey "^[OB" dirhistory_zle_dirhistory_down ;; # Terminal.app
85 esac
86+if (( ${+terminfo[kcud1]} )); then
87+ bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt
88+fi