From 36505c46c76c02ee0e9a7eb149ee555fb5ae6545 Mon Sep 17 00:00:00 2001 From: d10n Date: Wed, 26 Dec 2018 19:27:55 -0500 Subject: [PATCH 1/2] Explicitly disable word splitting when not fuzzy This prevents shell configuration from breaking fuzzy search configuration --- zsh-history-substring-search.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-history-substring-search.zsh b/zsh-history-substring-search.zsh index 0edf85e..73ce537 100644 --- a/zsh-history-substring-search.zsh +++ b/zsh-history-substring-search.zsh @@ -239,7 +239,7 @@ _history-substring-search-begin() { # _history_substring_search_query_parts=(${=_history_substring_search_query}) else - _history_substring_search_query_parts=(${_history_substring_search_query}) + _history_substring_search_query_parts=(${==_history_substring_search_query}) fi # From 19cb0eb8beffb16f160854b1e8dc5a166b246c50 Mon Sep 17 00:00:00 2001 From: d10n Date: Wed, 26 Dec 2018 19:31:21 -0500 Subject: [PATCH 2/2] Quote variable to highlight right words on zsh 4.3 When the variable is not quoted, there seems to be some difference in evaluating the line between zsh 4.3 and 5.6 --- zsh-history-substring-search.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-history-substring-search.zsh b/zsh-history-substring-search.zsh index 73ce537..70bbdf6 100644 --- a/zsh-history-substring-search.zsh +++ b/zsh-history-substring-search.zsh @@ -324,7 +324,7 @@ _history-substring-search-end() { for query_part in $_history_substring_search_query_parts; do local escaped_query_part=${query_part//(#m)[\][()|\\*?#<>~^]/\\$MATCH} # (i) get index of pattern - local query_part_match_index=${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]} + local query_part_match_index="${${BUFFER:$highlight_start_index}[(i)(#$HISTORY_SUBSTRING_SEARCH_GLOBBING_FLAGS)${escaped_query_part}]}" if [[ $query_part_match_index -le ${#BUFFER:$highlight_start_index} ]]; then highlight_start_index=$(( $highlight_start_index + $query_part_match_index )) highlight_end_index=$(( $highlight_start_index + ${#query_part} ))