mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-23 10:21:15 +01:00
Revert usage of fc
for suggestions and fix for sh_word_split.
Force field splitting on \0 to support sh_word_split option.
This commit is contained in:
parent
0faa2b6584
commit
6d25df6864
2 changed files with 12 additions and 2 deletions
|
@ -10,5 +10,10 @@ _zsh_autosuggest_suggestion() {
|
|||
# Escape the prefix (requires EXTENDED_GLOB)
|
||||
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
|
||||
|
||||
fc -ln -m "$prefix*" 2>/dev/null | tail -1
|
||||
# Get all history items (reversed) that match pattern $prefix*
|
||||
local history_matches
|
||||
history_matches=(${(j:\0:s:\0:)history[(R)$prefix*]})
|
||||
|
||||
# Echo the first item that matches
|
||||
echo "$history_matches[1]"
|
||||
}
|
||||
|
|
|
@ -293,7 +293,12 @@ _zsh_autosuggest_suggestion() {
|
|||
# Escape the prefix (requires EXTENDED_GLOB)
|
||||
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
|
||||
|
||||
fc -ln -m "$prefix*" 2>/dev/null | tail -1
|
||||
# Get all history items (reversed) that match pattern $prefix*
|
||||
local history_matches
|
||||
history_matches=(${(j:\0:s:\0:)history[(R)$prefix*]})
|
||||
|
||||
# Echo the first item that matches
|
||||
echo "$history_matches[1]"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
|
|
Loading…
Reference in a new issue