This commit is contained in:
Pavel Khromov 2026-04-21 22:57:10 +02:00 committed by GitHub
commit e9fa3209c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,12 @@ _zsh_autosuggest_start() {
# Mark for auto-loading the functions that we use
autoload -Uz add-zsh-hook is-at-least
# Hook that runs when line editing finishes (right before command execution)
_zsh_autosuggest_line_finish() {
# Clear POSTDISPLAY to prevent it from appearing in terminal
POSTDISPLAY=
}
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
# older versions because there is a bug when using async mode where ^C does not
# work immediately after fetching a suggestion.
@ -29,5 +35,8 @@ if is-at-least 5.0.8; then
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
fi
# Register the line finish hook
zle -N zle-line-finish _zsh_autosuggest_line_finish
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start

View File

@ -855,6 +855,12 @@ _zsh_autosuggest_start() {
# Mark for auto-loading the functions that we use
autoload -Uz add-zsh-hook is-at-least
# Hook that runs when line editing finishes (right before command execution)
_zsh_autosuggest_line_finish() {
# Clear POSTDISPLAY to prevent it from appearing in terminal
POSTDISPLAY=
}
# Automatically enable asynchronous mode in newer versions of zsh. Disable for
# older versions because there is a bug when using async mode where ^C does not
# work immediately after fetching a suggestion.
@ -863,5 +869,8 @@ if is-at-least 5.0.8; then
typeset -g ZSH_AUTOSUGGEST_USE_ASYNC=
fi
# Register the line finish hook
zle -N zle-line-finish _zsh_autosuggest_line_finish
# Start the autosuggestion widgets on the next precmd
add-zsh-hook precmd _zsh_autosuggest_start