-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Autosuggest eats buffer by ctrl+w #363
Comments
I pushed a failing spec to
|
Looks like this behavior can be reproduced by simply wrapping % my-backward-kill-word() { zle backward-kill-word }
% zle -N my-backward-kill-word
% bindkey ^W my-backward-kill-word |
The functionality where cut text is concatenated to be yanked in combined form later seems to be dependent on the two built-in cutting widgets running one directly after the other. Some interesting places in the upstream code:
So the flow when using
Because the kill commands aren't coming one after another, the text is not concatenated for yanking. Compare with the flow when using built-in
Not sure how this could be fixed. Next step is probably an email to the mailing list. |
Actually... there's a pretty easy fix if you're ok with not fetching suggestions after Add # After sourcing zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_IGNORE_WIDGETS+=(backward-kill-word) |
Also found this related issue in zsh-syntax-highlighting: zsh-users/zsh-syntax-highlighting#150 Looks like it hasn't been merged yet, but there's a commit danielshahaf/zsh-syntax-highlighting@bfa71c9 that uses |
Here is a patch based on @ericfreese comment and the solution he has linked |
I ran into this issue on and @ericfreese's hack worked for me. Would be great to get a long term fix for this merged in. Thanks for all of the great work on this plugin! |
The issue with the proposed workaround is that it leaves the suggestion while this is not valid. @macdems Maybe you could start a pull request with your suggestion? I think you need to somehow put the list of widgets into a specific variable, like this is done for |
@vincentbernat I can do this, but next week the earliest (no I am almost fully offline with no access to any computer). |
I have created a pull request. In my system yanking does not leave the suggestion, so it also seems to solve #526. |
I tried applying this patch on top of upstream. |
Has anyone gotten the normal behavior of I've been seeing broken behavior where Ctrl+w will gobble up the entire line always into the cut buffer, no matter that I've tried out the change in PR #551, but behavior is still the same unless I add The only way I've been able to get normal |
@trinitronx I just tried out PR #551 with zsh 5.9 and it works for me, though it also need a little fix for |
Given command:
echo first second
I want to cut two words
first second
by typing CTRL+WW .But then when I try to paste it with CTRL+Y I'm getting only one word:
first
.I'm using oh-my-zsh:
The text was updated successfully, but these errors were encountered: