mirror of
https://github.com/zsh-users/zsh-history-substring-search
synced 2024-09-20 08:09:05 +02:00
Support anchoring the substring to search for
Add a new config variable that will anchor the history search to the beginning of the command. Note that the default behavior does not change with this
This commit is contained in:
parent
47a7d416c6
commit
3f8e85f3f8
|
@ -246,7 +246,13 @@ _history-substring-search-begin() {
|
|||
# Escape and join query parts with wildcard character '*' as seperator
|
||||
# `(j:CHAR:)` join array to string with CHAR as seperator
|
||||
#
|
||||
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
#
|
||||
# Support anchoring history search to the beginning of the command
|
||||
#
|
||||
if [[ -z $HISTORY_SUBSTRING_SEARCH_ANCHORED ]]; then
|
||||
search_pattern="*${search_pattern}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Find all occurrences of the search pattern in the history file.
|
||||
|
|
Loading…
Reference in a new issue