mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Actually fix suggestions when sh_split_words
option is enabled.
This commit is contained in:
parent
dd9a8789a7
commit
a2d8d91196
2 changed files with 4 additions and 14 deletions
|
@ -8,12 +8,7 @@ _zsh_autosuggest_suggestion() {
|
||||||
setopt localoptions extendedglob
|
setopt localoptions extendedglob
|
||||||
|
|
||||||
# Escape the prefix (requires EXTENDED_GLOB)
|
# Escape the prefix (requires EXTENDED_GLOB)
|
||||||
local prefix=${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
|
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
|
||||||
|
|
||||||
# Get all history items (reversed) that match pattern $prefix*
|
fc -ln -m "$prefix*" 2>/dev/null | tail -1
|
||||||
local history_matches
|
|
||||||
history_matches=(${history[(R)$prefix*]})
|
|
||||||
|
|
||||||
# Echo the first item that matches
|
|
||||||
echo ${history_matches[1]}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -291,14 +291,9 @@ _zsh_autosuggest_suggestion() {
|
||||||
setopt localoptions extendedglob
|
setopt localoptions extendedglob
|
||||||
|
|
||||||
# Escape the prefix (requires EXTENDED_GLOB)
|
# Escape the prefix (requires EXTENDED_GLOB)
|
||||||
local prefix=${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
|
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
|
||||||
|
|
||||||
# Get all history items (reversed) that match pattern $prefix*
|
fc -ln -m "$prefix*" 2>/dev/null | tail -1
|
||||||
local history_matches
|
|
||||||
history_matches=(${history[(R)$prefix*]})
|
|
||||||
|
|
||||||
# Echo the first item that matches
|
|
||||||
echo ${history_matches[1]}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------#
|
#--------------------------------------------------------------------#
|
||||||
|
|
Loading…
Reference in a new issue