Backward search in vi-mode [closed]
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a开发者_开发百科 comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this questionI 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?
You can bind history-incremental-search-backward
to any key, for example:
bindkey -M vicmd '?' history-incremental-search-backward
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
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
精彩评论