From 6d7bc718aee81b9afa9e146b5567be014b3ff8f0 Mon Sep 17 00:00:00 2001 From: "Suraj N. Kurapati" Date: Mon, 6 Apr 2015 17:33:27 -0700 Subject: [PATCH] skip HIST_FIND_NO_DUPS if HIST_IGNORE_ALL_DUPS set Thanks to @ELLIOTTCABLE for suggesting this optimization: https://github.com/zsh-users/zsh-history-substring-search/issues/19#issuecomment-90295460 --- zsh-history-substring-search.zsh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zsh-history-substring-search.zsh b/zsh-history-substring-search.zsh index 333c966..1a9a13f 100644 --- a/zsh-history-substring-search.zsh +++ b/zsh-history-substring-search.zsh @@ -474,8 +474,9 @@ function _history-substring-search-up-search() { # # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. # - if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then # # Repeat the current search so that a different (unique) match is found. # @@ -570,8 +571,9 @@ function _history-substring-search-down-search() { # # When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from # history should be matched, make sure the new and old results are different. + # But when HIST_IGNORE_ALL_DUPS is set, ZSH already ensures a unique history. # - if [[ -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then + if [[ ! -o HIST_IGNORE_ALL_DUPS && -o HIST_FIND_NO_DUPS && $BUFFER == $_history_substring_search_result ]]; then # # Repeat the current search so that a different (unique) match is found. #