Zsh-autosuggestions: ZSH_AUTOSUGGEST_USE_ASYNC breaks shell history

Created on 16 May 2017  路  15Comments  路  Source: zsh-users/zsh-autosuggestions

When adding the option ZSH_AUTOSUGGEST_USE_ASYNC=true to my ~/.zshrc file, this breaks command history. Pressing up button on keyboard will retrieve at most the 2 most recent commands. When I remove this option from my ~/.zshrc file, command history functionality returns to normal

bug

All 15 comments

Oh dang. I bet this is related to #227. One of my last commits before v0.4.0 was to disable async by default so I bet that's what "fixed" it.

Hi all,

Can anybody confirm if shell history is broken again?

Zsh

~ % zsh --version
zsh --version
zsh 5.4.2 (x86_64-apple-darwin17.0.0)

zsh-autosuggestions (just cloned), enabled via _oh-my-zsh_:

~ % head -n3 /Users/cig0/.oh-my-zsh/custom/plugins/zsh-autosuggestions/CHANGELOG.md
# Changelog

## v0.4.0

~/.zshrc

plugins=(
    ...
    zsh-autosuggestions
    ...
)

# Plugins configuration
...
ZSH_AUTOSUGGEST_USE_ASYNC="true"  ## zsh-autosuggest

Thanks!

Yes it is still broken.

Also, @cig0 you might need to set ZSH_AUTOSUGGEST_USE_ASYNC before the plugins array.

Also we should probably check if ZSH_AUTOSUGGEST_USE_ASYNC is set to 1 or true, rather than checking if defined.

@partounian does it need to be before the plugins array? I don't see that mentioned in the docs

@aarbor989 I was wrong, it executes before each prompt (precmd).

https://github.com/zsh-users/zsh-autosuggestions/blob/master/zsh-autosuggestions.zsh#L699

This is still broken, b4 it gets fixed i suggest writing this issue to README.md to notice ppl

I've got a hypothesis based on #227 that this is only an issue when using up-line-or-beginning-search and down-line-or-beginning-search. Is anyone here seeing this issue while using other widgets?

You can check what your up and down keys are bound to by running:

$ bindkey $terminfo[kcuu1]

and

$ bindkey $terminfo[kcud1]

And for those who may want to dig in, source of that widget is here: https://github.com/zsh-users/zsh/blob/master/Functions/Zle/up-line-or-beginning-search

@ericfreese I have confirmed the issue and I am using up-line-or-beginning-search and down-line-or-beginning-search.

If we confirm that it is only an issue with *-line-or-beginning-search, the first step toward fixing it would be to write a failing test. A test for this would live in spec/integrations. Could look at some of the other specs in that directory for inspiration.

Not sure if it helps but I use oh-my-zsh and have not added the *-line-or-beginning-search it is in their file here https://github.com/robbyrussell/oh-my-zsh/blob/master/lib/key-bindings.zsh

Ok should be fixed on develop. In the mean time you can also add up-line-or-beginning-search and down-line-or-beginning-search to ZSH_AUTOSUGGEST_CLEAR_WIDGETS.

Appears to be working fine for me in develop, thanks!

Same (I've been using it since you pushed it)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

srajasimman picture srajasimman  路  5Comments

metalmac picture metalmac  路  4Comments

silverneko picture silverneko  路  5Comments

OmeGak picture OmeGak  路  3Comments

hiteshsharma picture hiteshsharma  路  5Comments