From 6efbcce604d1ec47f0105ae76188847af59899e6 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Mon, 28 Oct 2019 14:21:45 +0100 Subject: [PATCH] =?UTF-8?q?hsmw:=20^=20(if=20first)=20matches=20beginning?= =?UTF-8?q?=20of=20the=20string,=20$=20(if=20last),=C2=A0the=20end?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- history-search-multi-word | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/history-search-multi-word b/history-search-multi-word index ef2eebe..535b1fc 100644 --- a/history-search-multi-word +++ b/history-search-multi-word @@ -94,8 +94,10 @@ if (( ${+functions[_hsmw_main]} == 0 )); then # Find history entries matching pattern *word1*~^*word2*~^*word3* etc. 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/(#s)\\\^/(#s)}" + search_buffer="${search_buffer/\$(#e)/(#e)}" + search_buffer="${search_buffer## ##}" # Pattern will be *foo*~^*bar* (inventor: Mikael Magnusson) # It's: foo and not what doesn't contain bar, etc. search_pattern="${search_buffer// ##/*~^*}"