mirror of
https://github.com/zdharma-continuum/history-search-multi-word
synced 2024-11-21 19:03:11 +00:00
hsmw: ^ (if first) matches beginning of the string, $ (if last), the end
This commit is contained in:
parent
ab2cb3444b
commit
6efbcce604
1 changed files with 3 additions and 1 deletions
|
@ -94,8 +94,10 @@ if (( ${+functions[_hsmw_main]} == 0 )); then
|
||||||
|
|
||||||
# Find history entries matching pattern *word1*~^*word2*~^*word3* etc.
|
# Find history entries matching pattern *word1*~^*word2*~^*word3* etc.
|
||||||
local search_buffer="${BUFFER%% ##}" search_pattern="" colsearch_pattern="" nl=$'\n' MATCH MBEGIN MEND
|
local search_buffer="${BUFFER%% ##}" search_pattern="" colsearch_pattern="" nl=$'\n' MATCH MBEGIN MEND
|
||||||
search_buffer="${search_buffer## ##}"
|
|
||||||
search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}"
|
search_buffer="${search_buffer//(#m)[][*?|#~^()><\\]/\\$MATCH}"
|
||||||
|
search_buffer="${search_buffer/(#s)\\\^/(#s)}"
|
||||||
|
search_buffer="${search_buffer/\$(#e)/(#e)}"
|
||||||
|
search_buffer="${search_buffer## ##}"
|
||||||
# Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson)
|
# Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson)
|
||||||
# It's: foo and not what doesn't contain bar, etc.
|
# It's: foo and not what doesn't contain bar, etc.
|
||||||
search_pattern="${search_buffer// ##/*~^*}"
|
search_pattern="${search_buffer// ##/*~^*}"
|
||||||
|
|
Loading…
Reference in a new issue