2016-02-05 15:14:08 -07:00
|
|
|
|
2016-02-14 00:29:43 -07:00
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
|
# Suggestion #
|
|
|
|
|
#--------------------------------------------------------------------#
|
2016-02-05 15:14:08 -07:00
|
|
|
|
|
|
|
|
# Get a suggestion from history that matches a given prefix
|
|
|
|
|
_zsh_autosuggest_suggestion() {
|
|
|
|
|
setopt localoptions extendedglob
|
|
|
|
|
|
|
|
|
|
# Escape the prefix (requires EXTENDED_GLOB)
|
2016-02-16 09:33:26 -07:00
|
|
|
local prefix="${1//(#m)[\][()|\\*?#<>~^]/\\$MATCH}"
|
2016-02-05 15:14:08 -07:00
|
|
|
|
2016-02-16 09:33:26 -07:00
|
|
|
fc -ln -m "$prefix*" 2>/dev/null | tail -1
|
2016-02-05 15:14:08 -07:00
|
|
|
}
|