Fails to suggest past first word #109

Closed
a-m-s opened this Issue Feb 8, 2016 · 11 comments

3 participants

@a-m-s

I'm sure it used to continue to find suggestions after I typed the command name and got into the options, but no longer.

Now, as soon as I press space, it somehow duplicates the command at the end of the line, and refuses to suggest anything useful. Pressing up does suggest what I'm looking for (presumably that's history-substring-search though).

I'm using zsh-syntax-highlighting and zsh-history-substring-search, but I've followed all the directions in the README.

@a-m-s

I now tried it with the other plugins disabled. Same problem: it will autosuggest the first word, but no further.

@1ambda

Same problem even if i have no plugin (I'm using zsh 5.0.8 (x86_64-apple-darwin15.0))

screen shot 2016-02-12 at 7 28 47 pm

My .zshrc configuration is

source ~/.zplug/zplug

# zplug "plugins/brew", from:oh-my-zsh
# zplug "plugins/brew-cask", from:oh-my-zsh
# zplug "plugins/osx", from:oh-my-zsh
# zplug "plugins/pod", from:oh-my-zsh
#
# zplug "plugins/scala", from:oh-my-zsh
# zplug "plugins/sbt", from:oh-my-zsh
# zplug "plugins/npm", from:oh-my-zsh
# zplug "plugins/nvm", from:oh-my-zsh
# zplug "plugins/pyenv", from:oh-my-zsh
# zplug "plugins/pip", from:oh-my-zsh
#
# zplug "plugins/git", from:oh-my-zsh
# zplug "plugins/git-flow", from:oh-my-zsh
# zplug "plugins/git-extras", from:oh-my-zsh
#
# zplug "plugins/command-not-found", from:oh-my-zsh
# zplug "plugins/fasd", from:oh-my-zsh
# zplug "plugins/tmux", from:oh-my-zsh
# zplug "plugins/tmuxinator", from:oh-my-zsh
# zplug "plugins/history-peco", from:oh-my-zsh
# zplug "plugins/common-aliases", from:oh-my-zsh
# zplug "plugins/web-search", from:oh-my-zsh
#
# zplug "zsh-users/zsh-completions"
# zplug "b4b4r07/enhancd", of:enhancd.sh
# zplug "supercrabtree/k"

zplug "tarruda/zsh-autosuggestions", of:"dist/autosuggestions.zsh"
# export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=243"
# zplug "zsh-users/zsh-history-substring-search", nice:18
# zplug "jimmijj/zsh-syntax-highlighting", nice:19

zplug load --verbose

if zplug check tarruda/zsh-autosuggestions; then
  ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(history-substring-search-up history-substring-search-down) # Add history-substring-search-* widgets t
  ZSH_AUTOSUGGEST_CLEAR_WIDGETS=("${(@)ZSH_AUTOSUGGEST_CLEAR_WIDGETS:#(up|down)-line-or-history}") # Remove *-line-or-history widgets f
  autosuggest_start # Enable autosuggestions
fi

bindkey '^ ' autosuggest-accept
@ericfreese
zsh-users member

I'm not familiar with zplug. Can you confirm you still have the problem with a more minimal configuration?

Try installing with:

$ git clone git://github.com/tarruda/zsh-autosuggestions ~/.zsh/zsh-autosuggestions

and confirming you have the latest version:

$ git -C ~/.zsh/zsh-autosuggestions rev-parse --short HEAD
011f542

and using the following .zshrc:

source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh

Then start a new terminal session and confirm the problem persists.

@a-m-s

It seems to work for me with the most simple setup (start zsh -f and source the plugin manually), but not with my regular setup, even with other plugins disabled. I'll have to do a bit more investigation to get a minimal reproducer.

@ericfreese
zsh-users member

I'll have to do a bit more investigation to get a minimal reproducer.

That would be very helpful. Thanks!

@a-m-s

Here's the minimal reproducer:

$ zsh -f
% setopt sh_word_split
% source zsh-autosuggestions.zsh 

Then type "source" (with the trailing space), to autosuggest the previous command, and you should see this:

% source source

The sh_word_split tells to zsh to expand parameters the same way that bash does. It looks like you ought to add some quotes round variable parameters in your script somewhere.

@ericfreese
zsh-users member

👍 @a-m-s. Thanks for tracking this down. This issue should now be fixed with v0.2.8.

@ericfreese ericfreese closed this Feb 16, 2016
@a-m-s

I still see the problem??

$ git describe --tags
v0.2.8
$ zsh -f
% source zsh-autosuggestions.zsh 
% setopt sh_word_split          
% source source
@ericfreese
zsh-users member

Ok... let's try this one more time. Give v0.2.9 a shot.

@a-m-s

Success! 👍

@ericfreese
zsh-users member

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment