Open Amar1729 opened 1 year ago
Slight addendum: as the SO post notes, the same behavior can be achieved built-in by alt+0 alt+.
and indeed, bindkey -s '^[,' '\e0\e.'
does properly insert the first word from the previous command while the plugin is sourced. So while this particular issue has a solution, I'm not sure if this indicates some deeper bug that could mess up something else.
Thanks, this saved me time to figure out what was wrong with my shell.
Disabling autosuggestions worked for me.
My best guess is that something changed with zsh 5.9. This issue seems to have started happening with zsh 5.9, which is the default version of the latest macOS 14.4.1 (Sonoma) and is the latest version installed by Homebrew. In contrast, the latest one for Ubuntu 22.04 is zsh 5.8.1, which may be why we haven't seen many people complain yet. And with zsh 5.8, there's no issue.
Describe the bug
I have the following widget defined and bound in my rc (copied from this stackoverflow post):
This used to work as expected: when pressing
alt + ,
(orescape ,
), zsh would insert the first word of the previous command. However, it now inserts the last word of the previous command (commonly^[.
, orinsert-last-word
(no argument)).To Reproduce
Steps to reproduce the behavior:
If you do the above in the reverse order (
bindkey
commands first, thensource
), you'll notice that the keybinds work as expected before thesource
.Expected behavior
As
man zshzle
indicates, this wrapper forinsert-last-word -- -1 1
should insert the first word of the previous command.Screenshots
Desktop
v0.6.0
,v0.5.0
,v0.4.0
,v0.3.0
Tested with
v0.2.0
as well, got:Additional context
I'm quite confused how this used to work in my config and doesn't anymore. I haven't updated plugins recently, but apparently I must have changed something seemingly unrelated in my config. Will keep looking, but not sure I'll be able to track down what the issue is myself.
I also tried
unset ZSH_AUTOSUGGEST_USE_ASYNC
andexport ZSH_AUTOSUGGEST_MANUAL_REBIND=1
(after sourcing the plugin), but neither of those seemed to make a difference.