Branch v0.1.x breaks 1. accepting suggestion by character with right arrow, 2. accepting whole suggestion with END/Ctrl+E #93

Closed
ronjouch opened this Issue Jan 27, 2016 · 6 comments

2 participants

@ronjouch

I'm trying branch v0.1.x following bugs #88 and #92.

  • Before (at 7a00bfa ), I could:
    • Accept a single suggestion character by pressing the right arrow
    • Accept the whole suggestion with the end key (or Ctrl+E).
  • On branch v0.1.x,
    • Pressing the right arrow now accepts the whole suggestion. There is no way to nibble my way through the suggestion (and e.g. stop where I want a different parameter)
    • Pressing the end/Ctrl+E key now does nothing.

Is this an intentional change? Is it possible to revert to the old bindings?

Using zsh 5.2 with the plugin at f2031ce

@ronjouch ronjouch changed the title from Branch v0.1.x breaks accepting suggestion by character, and accepting whole suggestion with END key to Branch v0.1.x breaks 1. accepting suggestion by character with right arrow, 2. accepting whole suggestion with END/Ctrl+E Jan 27, 2016
@ericfreese
zsh-users member

Pressing the right arrow now accepts the whole suggestion.

This was intentional. The plugin is supposed to be fish-style, and this is the way fish works, so I think the default should be to accept the whole suggestion. Though I'll look into the possibility of overriding the default to only partially accept the suggestion (e.g. single-character).

Pressing the end/Ctrl+E key now does nothing.

This was mostly intentional too, but really just as a means of simplifying the plugin while rewriting it. I don't use the end key to accept, so I didn't add it back in. I'll add this to the TODO on the pull request and have it working before merging it into master.

@ronjouch

This was intentional. The plugin is supposed to be fish-style, and this is the way fish works, so I think the default should be to accept the whole suggestion.

Sucks for me-as-I'm-used-to-the-old-behavior, but I understand the intention. Closing.

@ronjouch ronjouch closed this Jan 27, 2016
@ericfreese ericfreese referenced this issue Jan 27, 2016
Merged

Cleanup #91

6 of 7 tasks complete
@ericfreese
zsh-users member

@ronjouch Good news for you!

I was able to get partial acceptance working. I noticed that forward-word in fish actually does partially accept the suggestion, so implemented the same functionality here.

By default though, the right arrow key (forward-char) does fully accept the suggestion. To get it to partially accept the suggestion, remove it from the list of 'accept' widgets and add it to the list of 'partial accept' widgets in your zshrc. Something like this:

# Remove forward-char widgets from ACCEPT
ZSH_AUTOSUGGEST_ACCEPT_WIDGETS=("${(@)ZSH_AUTOSUGGEST_ACCEPT_WIDGETS:#forward-char}")

# Add forward-char widgets to PARTIAL_ACCEPT
ZSH_AUTOSUGGEST_PARTIAL_ACCEPT_WIDGETS+=(forward-char)

You may want to do the same with vi-forward-char.

P.S. end-of-line now also accepts the suggestion. You do however (like Fish) still need to have the cursor positioned at the end of the buffer.

@ronjouch

@ericfreese cooool :) , and doubly cool that it stays kinda-close to fish.

Tested, works as advertised for me on zsh 5.2 (in combination with oh-my-zsh plugins virtualenvwrapper colored-man-pages httpie npm pip git python sudo history-substring-search docker zsh-navigation-tools zsh-syntax-highlighting plus autojump, nvm).

Thanks! 👍 👍 👍

@ronjouch

@ericfreese I had a nasty regression yesterday on v0.1.x that caused mid-line edition of an accepted suggestion to scrap from cursor to end of line, but it disappeared with the last commit(s). Seems as good as 7a00bfa to me.

@ericfreese
zsh-users member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment