This adds a new widget, autosuggest-execute, that accepts and executes the current suggestion.
It is not triggered by any widgets by default. ZSH_AUTOSUGGEST_EXECUTE_WIDGETS is empty by default, but widgets can be added to that array after sourcing the plugin or the widget can be used with bindkey.
Two ways of using it:
You can add widgets to ZSH_AUTOSUGGEST_EXECUTE_WIDGETS. For example, this will accept and execute the suggestion when the accept-line widget is triggered (usually when you press enter).
# Remove accept-line from CLEAR list
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#accept-line}")
# Add accept-line to EXECUTE list
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS+=(accept-line)
You can bind a keypress to it using bindkey. For example, this will accept and execute the suggestion when you press enter:
This adds a new widget,
autosuggest-execute, that accepts and executes the current suggestion.It is not triggered by any widgets by default.
ZSH_AUTOSUGGEST_EXECUTE_WIDGETSis empty by default, but widgets can be added to that array after sourcing the plugin or the widget can be used withbindkey.Two ways of using it:
You can add widgets to
ZSH_AUTOSUGGEST_EXECUTE_WIDGETS. For example, this will accept and execute the suggestion when theaccept-linewidget is triggered (usually when you press enter).You can bind a keypress to it using
bindkey. For example, this will accept and execute the suggestion when you press enter:cc @hitripod