44

I just discovered the possibility to use vi-mode in zsh. Pretty awesome. But I used CTRL-r in emacs-mode pretty much and really really miss it. Is there something alike or can I get that functionality in vi-mode as well?

1
  • Common, it belongs to superuser
    – Drakosha
    Jun 27, 2010 at 15:02

3 Answers 3

39

You can bind history-incremental-search-backward to any key, for example:

bindkey -M vicmd '?' history-incremental-search-backward
2
37

According to this answer: https://unix.stackexchange.com/a/30169

you can actually bind in vim-mode to the history search:

bindkey '^R' history-incremental-search-backward

According to a comment to the answer you can also bind to history-incremental-pattern-search-backward

bindkey '^R' history-incremental-pattern-search-backward

Then you do a history pattern search with

example: <C-R> mv * /target

13

This is the solution: up/down allows to either browse history (if field is empty) or search. Made my day.

bindkey '^[[A' up-line-or-search
bindkey '^[[B' down-line-or-search

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