mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-12-30 00:03:56 +08:00
Merge pull request #275 from zsh-users/fixes/warn_nested_var_opt
Use typeset -g to avoid warnnestedvar warnings
This commit is contained in:
commit
680ce21f26
|
@ -10,14 +10,14 @@ _zsh_autosuggest_incr_bind_count() {
|
|||
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
|
||||
fi
|
||||
|
||||
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
}
|
||||
|
||||
_zsh_autosuggest_get_bind_count() {
|
||||
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
|
||||
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
else
|
||||
bind_count=0
|
||||
typeset -gi bind_count=0
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ _zsh_autosuggest_highlight_apply() {
|
|||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if [ $#POSTDISPLAY -gt 0 ]; then
|
||||
_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
|
||||
else
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
|
|
@ -11,5 +11,5 @@ _zsh_autosuggest_strategy_default() {
|
|||
|
||||
# Get the history items that match
|
||||
# - (r) subscript flag makes the pattern match on values
|
||||
suggestion="${history[(r)${(b)prefix}*]}"
|
||||
typeset -g suggestion="${history[(r)${(b)prefix}*]}"
|
||||
}
|
||||
|
|
|
@ -48,5 +48,5 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
|
|||
done
|
||||
|
||||
# Give back the matched history entry
|
||||
suggestion="$history[$histkey]"
|
||||
typeset -g suggestion="$history[$histkey]"
|
||||
}
|
||||
|
|
|
@ -131,14 +131,14 @@ _zsh_autosuggest_incr_bind_count() {
|
|||
_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]=1
|
||||
fi
|
||||
|
||||
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
}
|
||||
|
||||
_zsh_autosuggest_get_bind_count() {
|
||||
if ((${+_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]})); then
|
||||
bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
typeset -gi bind_count=$_ZSH_AUTOSUGGEST_BIND_COUNTS[$1]
|
||||
else
|
||||
bind_count=0
|
||||
typeset -gi bind_count=0
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ _zsh_autosuggest_highlight_apply() {
|
|||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
||||
if [ $#POSTDISPLAY -gt 0 ]; then
|
||||
_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
typeset -g _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT="$#BUFFER $(($#BUFFER + $#POSTDISPLAY)) $ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE"
|
||||
region_highlight+=("$_ZSH_AUTOSUGGEST_LAST_HIGHLIGHT")
|
||||
else
|
||||
unset _ZSH_AUTOSUGGEST_LAST_HIGHLIGHT
|
||||
|
@ -482,7 +482,7 @@ _zsh_autosuggest_strategy_default() {
|
|||
|
||||
# Get the history items that match
|
||||
# - (r) subscript flag makes the pattern match on values
|
||||
suggestion="${history[(r)${(b)prefix}*]}"
|
||||
typeset -g suggestion="${history[(r)${(b)prefix}*]}"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
|
@ -534,7 +534,7 @@ _zsh_autosuggest_strategy_match_prev_cmd() {
|
|||
done
|
||||
|
||||
# Give back the matched history entry
|
||||
suggestion="$history[$histkey]"
|
||||
typeset -g suggestion="$history[$histkey]"
|
||||
}
|
||||
|
||||
#--------------------------------------------------------------------#
|
||||
|
|
Loading…
Reference in New Issue
Block a user