From d7fb8caa2a6a91cef4cda3f576d3f461f9a37504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20=27Necoro=27=20Neumann?= Date: Tue, 3 Dec 2013 06:51:08 +0100 Subject: zsh: Make up-/down- to only use local history and Ctrl-R/-S to use global history. --- .zsh/zshrc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to '.zsh') diff --git a/.zsh/zshrc b/.zsh/zshrc index 426b6f9..dc7ac2b 100644 --- a/.zsh/zshrc +++ b/.zsh/zshrc @@ -226,6 +226,7 @@ _set_cwd # Key bindings {{{ ################################################# bindkey -e # use emacs style :) + if is-at-least 4.3.9; then bindkey "^R" history-incremental-pattern-search-backward bindkey "^S" history-incremental-pattern-search-forward @@ -239,7 +240,6 @@ bindkey "^[-" copy-prev-word # delete previous word upto next whitespace bindkey "^ew" backward-kill-word - # some 'insert x before' things for word c in sudo s vim v AK a; do eval "insert-$word() { LBUFFER=\"$word \$LBUFFER\" }" @@ -247,6 +247,18 @@ for word c in sudo s vim v AK a; do bindkey "^[i$c" insert-$word done +# use only local history on arrow-up +# but also imported one when using C-r +zle-line-init() { NUMERIC=1 zle set-local-history } +zle -N zle-line-init + +zle-isearch-update() { NUMERIC=0 zle set-local-history } +zle -N zle-isearch-update + +zle-isearch-exit() { NUMERIC=1 zle set-local-history } +zle -N zle-isearch-exit + +# fix Del, Pos1, End case $TERM in xterm*) bindkey "^[OH" beginning-of-line -- cgit v1.2.3