Skip to content

Commit

Permalink
feat(expansion): only clear autosuggestions if they are supported [#6]
Browse files Browse the repository at this point in the history
  • Loading branch information
olets committed Feb 24, 2020
1 parent 5d1fde0 commit 21e35b6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion zsh-abbr.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,12 @@ _zsh_abbr_last_word() {

_zsh_abbr_expand_accept() {
zle _zsh_abbr_expand_widget
zle autosuggest-clear # if using zsh-autosuggestions, clear any suggestion

# if using zsh-autosuggestions, clear any suggestion
if $ZSH_ABBR_USE_AUTOSUGGESTIONS; then
_zsh_autosuggest_clear
fi

zle accept-line
}

Expand Down Expand Up @@ -800,6 +805,12 @@ abbr() {
ZSH_ABBR_SYNC_UNIVERSALS=false
_zsh_abbr_init
ZSH_ABBR_SYNC_UNIVERSALS=true

ZSH_ABBR_USE_AUTOSUGGESTIONS=false
if command -v _zsh_autosuggest_clear 1>/dev/null; then
ZSH_ABBR_USE_AUTOSUGGESTIONS=true
fi

if [ "$ZSH_ABBR_DEFAULT_BINDINGS" = true ]; then
_zsh_abbr_bind_widgets
fi
Expand Down

0 comments on commit 21e35b6

Please sign in to comment.