comparison .zfun/zsh-autosuggestions/src/fetch.zsh @ 467:e1ce8897030d

zsh: import df6f6f9ff41 of zsh-autosuggestions
author Augie Fackler <raf@durin42.com>
date Mon, 03 Dec 2018 22:37:29 -0500
parents
children
comparison
equal deleted inserted replaced
466:f248cf012d9a 467:e1ce8897030d
1
2 #--------------------------------------------------------------------#
3 # Fetch Suggestion #
4 #--------------------------------------------------------------------#
5 # Loops through all specified strategies and returns a suggestion
6 # from the first strategy to provide one.
7 #
8
9 _zsh_autosuggest_fetch_suggestion() {
10 typeset -g suggestion
11 local -a strategies
12
13 # Ensure we are working with an array
14 strategies=(${=ZSH_AUTOSUGGEST_STRATEGY})
15
16 for strategy in $strategies; do
17 # Try to get a suggestion from this strategy
18 _zsh_autosuggest_strategy_$strategy "$1"
19
20 # Break once we've found a suggestion
21 [[ -n "$suggestion" ]] && break
22 done
23 }