From c83eb7f117fcbe03f138c55cf84a7226673987e1 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 20 May 2017 22:00:43 +0200 Subject: [PATCH 1/4] Add 'emacs-forward-word' This commit adds the 'emacs-forward-word' widget to the list of partial accept widgets. --- src/config.zsh | 1 + zsh-autosuggestions.zsh | 1 + 2 files changed, 2 insertions(+) diff --git a/src/config.zsh b/src/config.zsh index c7fc55a..ba694c0 100644 --- a/src/config.zsh +++ b/src/config.zsh @@ -42,6 +42,7 @@ ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=( # Widgets that accept the suggestion as far as the cursor moves ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=( forward-word + emacs-forward-word vi-forward-word vi-forward-word-end vi-forward-blank-word diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 0d389ec..9ea5960 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -78,6 +78,7 @@ ZSH_AUTOSUGGEST_EXECUTE_WIDGETS=( # Widgets that accept the suggestion as far as the cursor moves ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS=( forward-word + emacs-forward-word vi-forward-word vi-forward-word-end vi-forward-blank-word From 7518b8b3049dc13d57936b806bc043927dab4848 Mon Sep 17 00:00:00 2001 From: Isaac W Hanson Date: Fri, 18 Aug 2017 09:37:30 -0400 Subject: [PATCH 2/4] escape prefix before matching in match_prev_cmd strategy --- src/strategies/match_prev_cmd.zsh | 2 +- zsh-autosuggestions.zsh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index ee26346..a1cb696 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -26,7 +26,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)$prefix*]}) + history_match_keys=(${(k)history[(R)${(q)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}" diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 9ea5960..38a26df 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -533,7 +533,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)$prefix*]}) + history_match_keys=(${(k)history[(R)${(q)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}" From 4e4c759c8de42a29349ef1c10f72ef9d0e534062 Mon Sep 17 00:00:00 2001 From: Isaac W Hanson Date: Fri, 18 Aug 2017 09:41:51 -0400 Subject: [PATCH 3/4] fix tab to space conversion --- src/strategies/match_prev_cmd.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strategies/match_prev_cmd.zsh b/src/strategies/match_prev_cmd.zsh index a1cb696..9e61693 100644 --- a/src/strategies/match_prev_cmd.zsh +++ b/src/strategies/match_prev_cmd.zsh @@ -26,7 +26,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)${(q)prefix}*]}) + history_match_keys=(${(k)history[(R)${(q)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}" From 3846c4f8029de20df9b1d72c9c8bdfec920b65a8 Mon Sep 17 00:00:00 2001 From: Isaac W Hanson Date: Fri, 18 Aug 2017 09:42:17 -0400 Subject: [PATCH 4/4] fix tab to space conversion --- zsh-autosuggestions.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 38a26df..fd52ae3 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -533,7 +533,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() { # Get all history event numbers that correspond to history # entries that match pattern $prefix* local history_match_keys - history_match_keys=(${(k)history[(R)${(q)prefix}*]}) + history_match_keys=(${(k)history[(R)${(q)prefix}*]}) # By default we use the first history number (most recent history entry) local histkey="${history_match_keys[1]}"