]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
zsh/rc: use current input for incremental searches
authorSimon Ruderich <simon@ruderich.org>
Thu, 19 Jul 2018 09:06:14 +0000 (11:06 +0200)
committerSimon Ruderich <simon@ruderich.org>
Thu, 19 Jul 2018 09:10:13 +0000 (11:10 +0200)
shell/zsh/rc

index 0af99afb89db0be411dbaab526d462c16d5d6e08..99e46af4cee67038b5aba1129637b555fca12e06 100644 (file)
@@ -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