-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow fuzzy search to match after cursor position #96
base: master
Are you sure you want to change the base?
Conversation
@@ -246,7 +246,11 @@ _history-substring-search-begin() { | |||
# Escape and join query parts with wildcard character '*' as seperator | |||
# `(j:CHAR:)` join array to string with CHAR as seperator | |||
# | |||
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | |||
if [[ -z $HISTORY_SUBSTRING_SEARCH_FUZZY_AFTER_CURSOR ]]; then | |||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you factor out the duplication? 😱 It's safe to always execute this line. 🤓 Next, you can conditionally prefix the *
if this fuzzy-after-cursor option is not enabled.
if [[ -z $HISTORY_SUBSTRING_SEARCH_FUZZY_AFTER_CURSOR ]]; then | ||
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | ||
else | ||
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if [[ -z $HISTORY_SUBSTRING_SEARCH_FUZZY_AFTER_CURSOR ]]; then | |
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | |
else | |
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | |
fi | |
local search_pattern="*${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | |
if [[ -z $HISTORY_SUBSTRING_SEARCH_FUZZY_AFTER_CURSOR ]]; then | |
local search_pattern="${(j:*:)_history_substring_search_query_parts[@]//(#m)[\][()|\\*?#<>~^]/\\$MATCH}*" | |
fi |
I guess this would be the wanted behavior then?
Any update on this? |
Would also be interested in seeing this merged. |
Related PRs have been merged as of commit 4abed97. Please set the following configuration variable to enable this feature: HISTORY_SUBSTRING_SEARCH_PREFIXED=1 Does this solve the problem this PR was meant to address? |
No description provided.