zsh: Enable incremental backward search cycling
Previously enabled the search through shell history with ^r on the commandline. This is still the case, though now the results of the search can be cycled through with ^p (earlier) and ^n (later). The key combinations are only active in incremental search and will only search through the previous results. When in normal more, or command mode, ^p/^n will cycle through the history of the shell, taking into account what has already been typed and going through the history on the basis of this.
This commit is contained in:
parent
0e34af1992
commit
201cd58f3f
1 changed files with 6 additions and 2 deletions
|
@ -167,10 +167,14 @@ bindkey -a '^[[3~' delete-char
|
|||
# always allow removing words with <c-w>
|
||||
bindkey -a '^w' backward-kill-word
|
||||
# enable cycling through previous commands with <c-p/n>
|
||||
bindkey '^P' up-line-or-history
|
||||
bindkey '^N' down-line-or-history
|
||||
bindkey '^P' history-beginning-search-backward
|
||||
bindkey '^N' history-beginning-search-forward
|
||||
|
||||
# search history backwards <c-r>
|
||||
bindkey '^r' history-incremental-search-backward
|
||||
# cycle through history results
|
||||
bindkey -M isearch '^P' history-incremental-search-backward
|
||||
bindkey -M isearch '^N' history-incremental-search-forward
|
||||
|
||||
# Send command to editor and back for execution
|
||||
zle -N edit-command-line
|
||||
|
|
Loading…
Reference in a new issue