zsh-users / zsh-syntax-highlighting

Fish shell like syntax highlighting for Zsh.
github.com/zsh-users/zsh-syntax-highlighting
BSD 3-Clause "New" or "Revised" License
19.5k stars 1.32k forks source link

Bug: Breaks `bindkey -a` with non-control characters #934

Closed ad-chaos closed 10 months ago

ad-chaos commented 1 year ago

Reproduction

Test snippet to run in a clean zsh session (-dfi):

text() {echo "hello"}
zle -N text
bindkey -v
bindkey -a '^g' text
bindkey -a 'yg' text
source path/to/zsh-syntax-highlighting.zsh

Press esc to get into normal mode (vicmd) Press ctrl+g and see hello in the prompt Press yg to see nothing

Remove the last line sourcing zsh-sy-h and both the keybindings work as expected

Expected Behaviour

hello is seen in both the cases

Actual Behaviour

hello is only seen when doing ctrl+g and not when doing yg

phy1729 commented 11 months ago

I can't reproduce this on zsh 5.9 and z-sy-h 1386f12.

ad-chaos commented 11 months ago

Perhaps then I should mention I am on an M1 Mac. I tried head and I am still running into the issue

phy1729 commented 10 months ago

Since I can't reproduce this, I'll need someone from the community who can to try and find a root cause for the issue.

ad-chaos commented 10 months ago

I very distinctly remember being able to reproduce this very consistently by sourcing zsh-syntax-highlighting and setting those keybindings. But your comment made me try it once more and it worked just fine, which left me very confused.

I carefully removed one line at a time from my config, and found out that it was export KEYTIMEOUT=1 causing problems :/

Perhaps the non-control characters had nothing to do with it, but rather the style with which I was invoking them vs the ctrl+g binding, what made this problem more difficult to find is that I thought I was isolating my configuration out by starting a new subshell with zsh -dfi but that did nothing to isolate the environment variables!

Apologies for the false report.