Add zsh-autosuggestion
[zsh.git] / .zsh / external / zsh-autosuggestions / src / deprecated.zsh
1
2 #--------------------------------------------------------------------#
3 # Handle Deprecated Variables/Widgets #
4 #--------------------------------------------------------------------#
5
6 _zsh_autosuggest_deprecated_warning() {
7 >&2 echo "zsh-autosuggestions: $@"
8 }
9
10 _zsh_autosuggest_check_deprecated_config() {
11 if [ -n "$AUTOSUGGESTION_HIGHLIGHT_COLOR" ]; then
12 _zsh_autosuggest_deprecated_warning "AUTOSUGGESTION_HIGHLIGHT_COLOR is deprecated. Use ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE instead."
13 [ -z "$ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE" ] && ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=$AUTOSUGGESTION_HIGHLIGHT_STYLE
14 unset AUTOSUGGESTION_HIGHLIGHT_STYLE
15 fi
16
17 if [ -n "$AUTOSUGGESTION_HIGHLIGHT_CURSOR" ]; then
18 _zsh_autosuggest_deprecated_warning "AUTOSUGGESTION_HIGHLIGHT_CURSOR is deprecated."
19 unset AUTOSUGGESTION_HIGHLIGHT_CURSOR
20 fi
21
22 if [ -n "$AUTOSUGGESTION_ACCEPT_RIGHT_ARROW" ]; then
23 _zsh_autosuggest_deprecated_warning "AUTOSUGGESTION_ACCEPT_RIGHT_ARROW is deprecated. The right arrow now accepts the suggestion by default."
24 unset AUTOSUGGESTION_ACCEPT_RIGHT_ARROW
25 fi
26 }
27
28 _zsh_autosuggest_deprecated_start_widget() {
29 _zsh_autosuggest_deprecated_warning "The autosuggest-start widget is deprecated. For more info, see the README at https://github.com/zsh-users/zsh-autosuggestions."
30 zle -D autosuggest-start
31 eval "zle-line-init() {
32 $(echo $functions[${widgets[zle-line-init]#*:}] | sed -e 's/zle autosuggest-start//g')
33 }"
34 }
35
36 zle -N autosuggest-start _zsh_autosuggest_deprecated_start_widget