浏览代码

Merge pull request #2511 from FloFra/master

Makes history-substring-search use term specific up and down buttons.
Robby Russell 11 年之前
父节点
当前提交
5eb5f7138a
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      plugins/history-substring-search/history-substring-search.zsh

+ 7 - 2
plugins/history-substring-search/history-substring-search.zsh

@@ -163,8 +163,13 @@ function history-substring-search-down() {
 zle -N history-substring-search-up
 zle -N history-substring-search-up
 zle -N history-substring-search-down
 zle -N history-substring-search-down
 
 
-bindkey '\e[A' history-substring-search-up
-bindkey '\e[B' history-substring-search-down
+zmodload zsh/terminfo
+if [[ -n "$terminfo[kcuu1]" ]]; then
+  bindkey "$terminfo[kcuu1]" history-substring-search-up
+fi
+if [[ -n "$terminfo[kcud1]" ]]; then
+  bindkey "$terminfo[kcud1]" history-substring-search-down
+fi
 
 
 #-----------------------------------------------------------------------------
 #-----------------------------------------------------------------------------
 # implementation details
 # implementation details