add variable to configure case-sensitivity etc.
This commit is contained in:
parent
f9a4c753af
commit
c647fb423c
1 changed files with 3 additions and 2 deletions
|
|
@ -49,6 +49,7 @@ zmodload -F zsh/parameter
|
||||||
|
|
||||||
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
|
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=magenta,fg=white,bold'
|
||||||
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
|
HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND='bg=red,fg=white,bold'
|
||||||
|
HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS='i' # see "Globbing Flags" in zshexpn(1)
|
||||||
|
|
||||||
history-substring-search-begin() {
|
history-substring-search-begin() {
|
||||||
# continue using the previous "$history_substring_search_result" by default,
|
# continue using the previous "$history_substring_search_result" by default,
|
||||||
|
|
@ -66,7 +67,7 @@ history-substring-search-begin() {
|
||||||
# find all occurrences of the pattern *${query}* within the history file
|
# find all occurrences of the pattern *${query}* within the history file
|
||||||
# (k) turns it an array of line numbers. (on) seems to remove duplicates.
|
# (k) turns it an array of line numbers. (on) seems to remove duplicates.
|
||||||
# (on) are default options. they can be turned off by (ON).
|
# (on) are default options. they can be turned off by (ON).
|
||||||
history_substring_search_matches=(${(kon)history[(R)(#i)*${history_substring_search_query_escaped}*]})
|
history_substring_search_matches=(${(kon)history[(R)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)*${history_substring_search_query_escaped}*]})
|
||||||
|
|
||||||
# define the range of value that $history_substring_search_match_number
|
# define the range of value that $history_substring_search_match_number
|
||||||
# can take: [0, $history_substring_search_number_of_matches_plus_one]
|
# can take: [0, $history_substring_search_number_of_matches_plus_one]
|
||||||
|
|
@ -95,7 +96,7 @@ history-substring-search-highlight() {
|
||||||
# among other things, the following expression yields a variable $MEND,
|
# among other things, the following expression yields a variable $MEND,
|
||||||
# which indicates the end position of the first occurrence of
|
# which indicates the end position of the first occurrence of
|
||||||
# $history_substring_search_query_escaped in $BUFFER
|
# $history_substring_search_query_escaped in $BUFFER
|
||||||
: ${(S)BUFFER##(#mi)($history_substring_search_query##)}
|
: ${(S)BUFFER##(#m$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)($history_substring_search_query##)}
|
||||||
let "history_substring_search_query_mbegin = $MEND - $#history_substring_search_query"
|
let "history_substring_search_query_mbegin = $MEND - $#history_substring_search_query"
|
||||||
# this is slightly more informative than highlighting that fish performs
|
# this is slightly more informative than highlighting that fish performs
|
||||||
region_highlight+=("$history_substring_search_query_mbegin $MEND $1")
|
region_highlight+=("$history_substring_search_query_mbegin $MEND $1")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue