diff --git a/src/suggestion.zsh b/src/suggestion.zsh index 0a7ca1e..31a9f76 100644 --- a/src/suggestion.zsh +++ b/src/suggestion.zsh @@ -17,5 +17,5 @@ _zsh_autosuggest_escape_command() { setopt localoptions EXTENDED_GLOB # Escape special chars in the string (requires EXTENDED_GLOB) - echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}" + echo -E "${1//(#m)[\\()\[\]|*?~]/\\$MATCH}" } diff --git a/test/strategies_test.zsh b/test/strategies_test.zsh index 50d0a24..0a937f4 100644 --- a/test/strategies_test.zsh +++ b/test/strategies_test.zsh @@ -44,6 +44,12 @@ assertTildeSuggestion() { 'cd ~/something' } +assertTildeSuggestionWithExtendedGlob() { + setopt local_options extended_glob + + assertTildeSuggestion +} + assertParenthesesSuggestion() { set_history <<-'EOF' echo "$(ls foo)" @@ -87,6 +93,7 @@ testSpecialCharsForAllStrategies() { assertBackslashSuggestion assertDoubleBackslashSuggestion assertTildeSuggestion + assertTildeSuggestionWithExtendedGlob assertParenthesesSuggestion assertSquareBracketsSuggestion done diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 7e44a77..d2c7d2c 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -360,7 +360,7 @@ _zsh_autosuggest_escape_command() { setopt localoptions EXTENDED_GLOB # Escape special chars in the string (requires EXTENDED_GLOB) - echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}" + echo -E "${1//(#m)[\\()\[\]|*?~]/\\$MATCH}" } #--------------------------------------------------------------------#