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
20k stars 1.33k forks source link

REGION_ACTIVE and command word relative precedence #928

Open blueray453 opened 1 year ago

blueray453 commented 1 year ago

The following code does not work if I use zsh-syntax-highlighting

_ctrl-a() {
  MARK=0
  CURSOR=$#BUFFER
  REGION_ACTIVE=1
}

zle -N _ctrl-a
bindkey '^A' _ctrl-a # Ctrl+A

When i press ctrl+a it should select the whole buffer but, if i use this extension, it miss first word of every line.

issue

More details in the comment section of https://unix.stackexchange.com/a/747753/206574

phy1729 commented 1 year ago

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

danielshahaf commented 1 year ago

Using edit-command-line might be a useful workaround, depends on what you're trying to do.

Also, I'll be retitling this in a minute. What your screenshot shows is that the special parameters do get honoured, but the command word highlighting rule overrides them.