Hang with v0.1.x and zsh-history-substring-search in vi mode #99
Also, pressing CTRL-C when the prompt is consuming 100% of my CPU will kill whatever job is going crazy and make the prompt usable again.
Ah, the issue seems to be that the autosuggest-clear widget is involved in an infinite loop when the line is empty.
Gah... there's going to be a lot of these type of conflicts with other plugins.
This comes from the history-substring-search-up widget calling the up-line-or-history widget, which is aliased to autosuggest-clear.
The flow goes something like this:
You press k =>
history-substring-search-up=>autosuggest-clear=>_autosuggest_original_history-substring-search-up=>up-line-or-history=>autosuggest-clear=>...infinite recursion...
A temporary workaround might be to remove the up-line-or-history and down-line-or-history from the list of ZSH_AUTOSUGGEST_CLEAR_WIDGETS in your .zshrc:
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#up-line-or-history}")
ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#down-line-or-history}")
This would make the up-line-or-history widget not call the autosuggest-clear widget, fixing the chain of events above to be this:
You press k =>
history-substring-search-up=>autosuggest-clear=>_autosuggest_original_history-substring-search-up=>up-line-or-history
Another solution might be for the history-substring-search-up widget to call .up-line-or-history (the dot-prefixed version of the widget) instead.
Making the flow something like this:
You press k =>
history-substring-search-up=>autosuggest-clear=>_autosuggest_original_history-substring-search-up=>.up-line-or-history
I use zsh-history-substring-search with the 'k' key in vi command mode bound to
history-substring-search-up. When autosuggestions is loaded and I try to initiate a history search from an empty prompt, ZSH starts consuming 100% of my CPU and appears to do so indefinitely. If I disable autosuggestions, pressing 'k' steps back through history. If I have autosuggestions enabled, type at least one character, then press ESC and 'k', ZSH steps back through history. If I disable zsh-history-substring-search, so that 'k' performs its default behavior of stepping back through history (instead of searching), ZSH steps back through history. The problem only occurs when both zsh-history-substring-search and zsh-autosuggestions are enabled, and the input is currently empty (nothing typed at the prompt) when the search is initiated.