From 201cd58f3fe9853812f87bfea81501d983809070 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 6 Nov 2020 15:08:47 +0100 Subject: [PATCH] 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. --- zsh/.config/zsh/.zshrc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 5ce69e3..2abc150 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -167,10 +167,14 @@ bindkey -a '^[[3~' delete-char # always allow removing words with bindkey -a '^w' backward-kill-word # enable cycling through previous commands with -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 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