4d154abaa9abd46b6a4bbfa019413e155ef35ad2

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

Message

Merge branch 'apjanke-histsubstr-double-bind'

Close #4193

Diff

 1diff --git a/plugins/history-substring-search/history-substring-search.plugin.zsh b/plugins/history-substring-search/history-substring-search.plugin.zsh
 2index 25fd3a2daf8d512aa8f0d369285e8ed676aa4a3e..7883a65f39a3e3db9dcabe5e5411482fc5313404 100644
 3--- a/plugins/history-substring-search/history-substring-search.plugin.zsh
 4+++ b/plugins/history-substring-search/history-substring-search.plugin.zsh
 5@@ -13,11 +13,14 @@ fi
 6 
 7 
 8 # Bind terminal-specific up and down keys
 9-
10+# Bind in both emacs and vi modes so it works in both, and is not
11+# sensitive to whether this is loaded before or after the vi-mode plugin
12 if [[ -n "$terminfo[kcuu1]" ]]; then
13-  bindkey "$terminfo[kcuu1]" history-substring-search-up
14+  bindkey -M emacs "$terminfo[kcuu1]" history-substring-search-up
15+  bindkey -M viins "$terminfo[kcuu1]" history-substring-search-up
16 fi
17 if [[ -n "$terminfo[kcud1]" ]]; then
18-  bindkey "$terminfo[kcud1]" history-substring-search-down
19+  bindkey -M emacs "$terminfo[kcud1]" history-substring-search-down
20+  bindkey -M viins "$terminfo[kcud1]" history-substring-search-down
21 fi
22 
23diff --git a/plugins/history-substring-search/update-from-upstream.zsh b/plugins/history-substring-search/update-from-upstream.zsh
24index 6e6cca5d5ac8a81a197def1db5699acc91717188..81e1942a508e3358c63354be658c56ef0ba2c2ef 100755
25--- a/plugins/history-substring-search/update-from-upstream.zsh
26+++ b/plugins/history-substring-search/update-from-upstream.zsh
27@@ -76,10 +76,12 @@ cat >> $plugin_basename.plugin.zsh <<EOF
28 # Bind terminal-specific up and down keys
29 
30 if [[ -n "\$terminfo[kcuu1]" ]]; then
31-  bindkey "\$terminfo[kcuu1]" history-substring-search-up
32+  bindkey -M emacs "\$terminfo[kcuu1]" history-substring-search-up
33+  bindkey -M viins "\$terminfo[kcuu1]" history-substring-search-up
34 fi
35 if [[ -n "\$terminfo[kcud1]" ]]; then
36-  bindkey "\$terminfo[kcud1]" history-substring-search-down
37+  bindkey -M emacs "\$terminfo[kcud1]" history-substring-search-down
38+  bindkey -M viins "\$terminfo[kcud1]" history-substring-search-down
39 fi
40 
41 EOF