up arrow completion(up-line-or-history) doesn't work #80

Closed
jzk opened this Issue Oct 23, 2015 · 16 comments

6 participants

@jzk

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

@catmeme

I'm also experiencing this issue.

@f7n

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

@SeanTAllen

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

@wernight

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

@ericfreese
zsh-users member

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?

@wernight

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

@ericfreese
zsh-users member

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

@SeanTAllen

Same problem as main branch for me.

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

@ericfreese
zsh-users member

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

@SeanTAllen

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.

@ericfreese ericfreese added this to the v0.1.0 milestone Jan 29, 2016
@ericfreese
zsh-users member

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

@SeanTAllen

Plugin disabled:

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

Plugin enables:

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

@ericfreese
zsh-users member

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.

@SeanTAllen

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

@ericfreese
zsh-users member

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?

@ericfreese
zsh-users member

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.

@ericfreese ericfreese closed this Jan 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment