Rewrite
This commit is contained in:
parent
7dc9e0f926
commit
775dd20706
58 changed files with 8564 additions and 739 deletions
19
src/suggestion.zsh
Normal file
19
src/suggestion.zsh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
|
||||
#------------#
|
||||
# Suggestion #
|
||||
#------------#
|
||||
|
||||
# Get a suggestion from history that matches a given prefix
|
||||
_zsh_autosuggest_suggestion() {
|
||||
setopt localoptions extendedglob
|
||||
|
||||
# Escape the prefix (requires EXTENDED_GLOB)
|
||||
local prefix=${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}
|
||||
|
||||
# Get all history items (reversed) that match pattern $prefix*
|
||||
local history_matches
|
||||
history_matches=(${history[(R)$prefix*]})
|
||||
|
||||
# Echo the first item that matches
|
||||
echo ${history_matches[1]}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue