Zsh-autosuggestions: up arrow completion(up-line-or-history) doesn't work

Created on 23 Oct 2015  路  16Comments  路  Source: zsh-users/zsh-autosuggestions

After enabling zsh-autosuggestions, the up arrow key go through history with commands begin with words just typed doesn't work any more.

It seem it is disabled here

ZLE_AUTOSUGGEST_SUSPEND_WIDGETS=(
    vi-cmd-mode vi-backward-char backward-char backward-word beginning-of-line
    history-search-forward history-search-backward up-line-or-history

Is it because some incompatibility? Anyone know what's the alternative we have here? How can I enable it back? Thanks

bug

Most helpful comment

Ok, I believe you need to bind up and down to history-beginning-search-backward/forward widgets for it to search history entries that match the beginning of the buffer.

bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward

I'm not sure how you were getting the history-beginning-search-backward behavior without binding it.

All 16 comments

I'm also experiencing this issue.

Has anyone found a solution to this? Aside from this, I'm loving this extension.

Had to uninstall because of this and one other similar issue where I could autocomplete command flags.

I'm having same issue running via Oh-My-ZSH! and ZAW. Not sure if it affects everyone.

There's a rewrite underway in PR #91. It's available on branch v0.1.x. Can you verify that the problem still exists on that branch?

Not sure, it says: No such widget 'autosuggest-start'. Changed to autosuggest_start but says now: zle-line-init:2: command not found: autosuggest_start

@wernight Are you still having this problem? Are you sure you're sourcing the script correctly. Can you post your .zshrc?

Same problem as main branch for me.

.zshrc available at: https://gist.github.com/SeanTAllen/b78d1b036139e9f6b4fd

Looks like you're initializing the plugin wrong:

https://gist.github.com/SeanTAllen/b78d1b036139e9f6b4fd#file-zshrc-L239-L242

Try replacing:

zle-line-init() {
    zle autosuggest_start
}
zle -N zle-line-init

with:

zle -N zle-line-init autosuggest_start

And let me know if you're still having issues. Please be descriptive when describing exactly what problem you're facing.

Cheers

Tried w change in initialization. Up arrow when you've typed part of a command, for example

ls -al

returns results that aren't ls -al first for me

is a

pull

then

cd ~/.zsh/zsh-autosuggestions

without plugin on all are confined to ls -al results as one would expect.

Can you enter bindkey '\e[A' in your console and let me know the output (for both plugin enabled and plugin disabled cases)?

Plugin disabled:

"^[[A" up-line-or-history

Plugin enables:

"^[[A" up-line-or-history

Ok, I believe you need to bind up and down to history-beginning-search-backward/forward widgets for it to search history entries that match the beginning of the buffer.

bindkey '\e[A' history-beginning-search-backward
bindkey '\e[B' history-beginning-search-forward

I'm not sure how you were getting the history-beginning-search-backward behavior without binding it.

That works.

Issue still...

ls -

doesn't expand out various command line options.

Additional, the search history contains both complete items as well as autosuggested items. With those autosuggested items, right arrow doesn't work to accept those autosuggested items.

You can see an example in the attached file

screenshot 2016-01-28 21 30 51

ls - doesn't expand out various command line options.

This sounds like it's outside the scope of this plugin. It only makes suggestions based on previous history items.

With those autosuggested items, right arrow doesn't work to accept those autosuggested items.

Sorry but I don't know what this means. Can you clarify?

You can see an example in the attached file

Can you explain what I'm looking at? Is the portion to the right of the cursor (/usr/local/lib...) a suggestion?

That works.

I'm closing this issue for now since it was originally about not being able to navigate history. Please open new issues for other problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NikKovIos picture NikKovIos  路  4Comments

metalmac picture metalmac  路  4Comments

moritzschaefer picture moritzschaefer  路  5Comments

dragonxlwang picture dragonxlwang  路  3Comments

clay-f picture clay-f  路  7Comments