From: Simon Ruderich Date: Thu, 19 Jul 2018 09:06:14 +0000 (+0200) Subject: zsh/rc: use current input for incremental searches X-Git-Url: https://ruderich.org/simon/gitweb/?p=config%2Fdotfiles.git;a=commitdiff_plain;h=4feb6907a365f3dd19f246563c17656a7bc22f90 zsh/rc: use current input for incremental searches --- diff --git a/shell/zsh/rc b/shell/zsh/rc index 0af99af..99e46af 100644 --- a/shell/zsh/rc +++ b/shell/zsh/rc @@ -184,6 +184,13 @@ bindkey -a '^P' history-beginning-search-backward # binding for Vi-mode # after calling ^P. bindkey -a '^N' history-beginning-search-forward +# Use current input when pressing Ctrl-R. Thanks to Mikachu in #zsh on +# Freenode (2016-07-08 20:54 CEST). +zshrc-history-incremental-pattern-search-backward() { + zle .history-incremental-pattern-search-backward $BUFFER +} +zle -N history-incremental-pattern-search-backward \ + zshrc-history-incremental-pattern-search-backward # Enable incremental search which is especially useful when the string is an # argument and not the command. bindkey '^R' history-incremental-pattern-search-backward