Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I recently switched to zsh (finally) and am loving it! So far one thing that I am missing is Ctrl+R to do incremental history search.
I have the history set up properly

HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.zsh_history

and I used vi key bindings

bindkey -v

But Ctrl+R does not work. It removes the line above the current line, which is not the behavior it should have in vim either.

Any suggestions?

share|improve this question
    
btw a quick work-around is to use non-incremental search: Ctrl+[ / ... –  maxschlepzig Jan 27 '12 at 14:16

1 Answer 1

up vote 11 down vote accepted

If I recall correctly, you need to explicitly set it, even with bindkey -v. Use something like this:

bindkey -v
bindkey '^R' history-incremental-search-backward
share|improve this answer
1  
perhaps history-incremental-pattern-search-backward is an alternative action to use in that context. –  maxschlepzig Jan 27 '12 at 14:18
    
@maxschlepzig sorry what is the difference between the two? –  Ali Jan 27 '12 at 15:34
1  
@Ali, with the -pattern- versions you can use search-patterns (which style, i.e. globbing or regex (?) depends on other parts of your zsh-configuration) - like e.g. you can use the search-pattern fo*bar with grep to match 'fobar', 'foobar', 'fooobar' etc. –  maxschlepzig Jan 27 '12 at 21:03
1  
I was getting an error. Wrapping ^R in double quotes did it. bindkey "^R" history-incremental-pattern-search-backward –  Ramon Tayag Sep 8 '13 at 6:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.