-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
Howdy, I think I may have a solution for slow pastes (#141 #219) but I'm not sure if there are problems with it or what the best way to actually implement it is.
I believe that the paste slowdown comes from the additional zle invocation to call the original widget on self-insert. Rather than doing that, if, on disable, we replace self-insert with the original widget and then on enable, we replace it back, things are snappy.
Here is my naive implementation:
# Disable suggestions
_zsh_autosuggest_disable() {
typeset -g _ZSH_AUTOSUGGEST_DISABLED
_zsh_autosuggest_clear
zle -N self-insert url-quote-magic
}
# Enable suggestions
_zsh_autosuggest_enable() {
unset _ZSH_AUTOSUGGEST_DISABLED
zle -N self-insert _zsh_autosuggest_bound_1_self-insert
if [ $#BUFFER -gt 0 ]; then
_zsh_autosuggest_fetch
fi
}Obviously we shouldn't hard-code url-quote-magic or _zsh_autosuggest_bound_1_self-insert but I wasn't sure of the best way to get the right ones in there.
Thoughts? Suggestions? Thanks!
Metadata
Metadata
Assignees
Labels
No labels