mirror of
https://github.com/zsh-users/zsh-history-substring-search.git
synced 2026-11-11 11:41:49 -05:00
Merge pull request #97 from partcyborg/master
Also rename `HISTORY_SUBSTRING_SEARCH_PREFIX` variable by adding "ED" suffix so that it reads more like a special mode of operation rather than an instruction to prepend a specified prefix to matched commands.
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
: ${HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i'}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=''}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_FUZZY=''}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_PREFIX=''}
|
||||
: ${HISTORY_SUBSTRING_SEARCH_PREFIXED=''}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# declare internal global variables
|
||||
@@ -248,7 +248,13 @@ _history-substring-search-begin() {
|
||||
# `(j:CHAR:)` join array to string with CHAR as seperator
|
||||
#
|
||||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*"
|
||||
test -z "$HISTORY_SUBSTRING_SEARCH_PREFIX" && search_pattern="*$search_pattern"
|
||||
|
||||
#
|
||||
# Support anchoring history search to the beginning of the command
|
||||
#
|
||||
if [[ -z $HISTORY_SUBSTRING_SEARCH_PREFIXED ]]; then
|
||||
search_pattern="*${search_pattern}"
|
||||
fi
|
||||
|
||||
#
|
||||
# Find all occurrences of the search pattern in the history file.
|
||||
|
||||
Reference in New Issue
Block a user