mirror of
https://github.com/zsh-users/zsh-history-substring-search.git
synced 2026-11-11 11:41:49 -05:00
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
This commit is contained in:
@@ -474,8 +474,9 @@ function _history-substring-search-up-search() {
|
|||||||
#
|
#
|
||||||
# When HIST_FIND_NO_DUPS is set, meaning that only unique command lines from
|
# 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.
|
# 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.
|
# 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
|
# 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.
|
# 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.
|
# Repeat the current search so that a different (unique) match is found.
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user