2016-02-06 06:14:08 +08:00
|
|
|
|
2016-02-14 15:29:43 +08:00
|
|
|
#--------------------------------------------------------------------#
|
|
|
|
# Suggestion #
|
|
|
|
#--------------------------------------------------------------------#
|
2016-02-06 06:14:08 +08:00
|
|
|
|
2016-03-02 03:45:55 +08:00
|
|
|
# Delegate to the selected strategy to determine a suggestion
|
2016-02-06 06:14:08 +08:00
|
|
|
_zsh_autosuggest_suggestion() {
|
2016-03-02 03:45:55 +08:00
|
|
|
local prefix="$1"
|
|
|
|
local strategy_function="_zsh_autosuggest_strategy_$ZSH_AUTOSUGGEST_STRATEGY"
|
2016-02-06 06:14:08 +08:00
|
|
|
|
2016-03-02 03:45:55 +08:00
|
|
|
if [ -n "$functions[$strategy_function]" ]; then
|
|
|
|
echo -E "$($strategy_function "$prefix")"
|
|
|
|
fi
|
2016-02-24 11:11:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
_zsh_autosuggest_escape_command_prefix() {
|
|
|
|
setopt localoptions EXTENDED_GLOB
|
|
|
|
|
|
|
|
# Escape special chars in the string (requires EXTENDED_GLOB)
|
|
|
|
echo -E "${1//(#m)[\\()\[\]|*?]/\\$MATCH}"
|
2016-02-06 06:14:08 +08:00
|
|
|
}
|