marlonrichert / zsh-hist

📝 Edit your Zsh history from the command line.
MIT License
148 stars 13 forks source link

Plugin no longer working as expected after recent changes #23

Closed cjk closed 1 year ago

cjk commented 1 year ago

Describe the bug

Before commit 6b0e5e65bc477357b66df35cd93a1752bae85e03 this plugin was working as expected for me: ^q pushed a command to history and ^g retrieved it from history - perfect! :smile:

After the commit from above on Feb. 07 2023, this functionality broke. Now, when I press ^q the current command is added to the buffer-stack instead and automatically poped when I press enter :disappointed:

Steps To Reproduce

zinit light-mode for marlonrichert/zsh-hist

The above works as expected before Feb. 07 and stops working after Feb. 07

Expected behavior

Should continue to work as described, even after the changes introduced in February

Environment:

Additional context

I know you frown upon using zinit, however it worked flawlessly before, so perhaps it's not even zinit's fault?

marlonrichert commented 1 year ago

I'm unable to reproduce that. Here's the test environment I used:

cd $(mktemp -d)
> .zshrc <<EOF
PS1='%# ' PS2= RPS2='%^'; setopt transientrprompt interactivecomments
source /path/to/zsh-hist/zsh-hist.plugin.zsh
EOF
HOME=$PWD ZDOTDIR=$PWD zsh -d

Please try it in this environment and if the bug doesn't occur there, then the problem is definitely with Zinit. If you can find a way in which I can reproduce this that doesn't involve Zinit, then I'll reopen the issue.

There is no longer a keybinding for retrieving saved items from history, because there's plenty of keybindings for that already.

I did find some other bugs in my testing and pushed in a fix for those.

cjk commented 1 year ago

Hey @marlonrichert , thanks for giving it a try, I can understand your notion here. I'd also blame it on zinit, however simply reverting back to the commit prior the push-changes instantly fixes the problem for me.

Nevertheless, I'll try to analyze deeper once I get a chance and try without zinit.

marlonrichert commented 1 year ago

What output do you get from bindkey '^Q'?

cjk commented 1 year ago

What output do you get from bindkey '^Q'?

❯ bindkey '^Q'
"^Q" push-line-or-edit

but wait, when I restore the plugin to the latest main-branch changes, I suddenly get

"^Q" push-history

Didn't realize that before, so somehow my bindings changed after the update. That means if I find a way to switch back to push-line-or-edit it would solve my problem :thinking:

Update: sadly no, even if I change the binding back to push-line-or-edit, my pushed command gets immediatly auto-restored after hitting enter, which is not how it's supposed to work, I want to use get-line for that.

marlonrichert commented 1 year ago

bindkey ^Q should output "^Q" push-history. Looks like something else is overriding that keybinding.