zsh-users / zsh-autosuggestions

Fish-like autosuggestions for zsh
MIT License
31.57k stars 1.88k forks source link

ZSH_AUTOSUGGEST_STRATEGY=(history completion) not working with `bindkey` #667

Open xmlking opened 2 years ago

xmlking commented 2 years ago

I have following in my ~/.zshrc

ZSH_AUTOSUGGEST_STRATEGY=(history completion) not working with bindkey

# zsh-autosuggestions
if [[ -f "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ]]; then
    # will first try to find a suggestion from your history, but,
    # if it can't find a match, will find a suggestion from the completion engine.
    export ZSH_AUTOSUGGEST_STRATEGY=(history completion)
    source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh
    # Search Previous Used Commands using arrows
    # up and down arrows - history search
    autoload -U history-search-end
    zle -N history-beginning-search-backward-end history-search-end
    zle -N history-beginning-search-forward-end history-search-end
    bindkey "^[[A" history-beginning-search-backward-end
    bindkey "^[[B" history-beginning-search-forward-end
fi

When I press arrow key UP/DOWN keys, I only get suggestions form History. not from completion options.

image
gnoluv9x commented 2 years ago

I have the same problem

xmlking commented 2 years ago

I think there is a built-in binding for cycle through completions options with Ctrl + i but it nullify the easyness of having KeyUP/DOWN to cycle through history + completion options.