Skip to content
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

history-expansion does not highlight & (previous substitution modifier) character #929

Open
zaidhaan opened this issue Jun 3, 2023 · 2 comments

Comments

@zaidhaan
Copy link

zaidhaan commented Jun 3, 2023

Screenshot: (note that expansion does work as expected after hitting return. & however, is not highlighted)
image

Reproducible setup:

$ echo foo_replaceme_bar
$ echo baz_replaceme_qux
$ !-2:s/replaceme/subst/ && !-1:&   

Relevant zsh manual section: 14.1.4 Modifiers.

&
Repeat the previous s substitution. Like s, may be preceded immediately by a g. In parameter expansion the & must appear inside braces, and in filename generation it must be quoted with a backslash.

I'm no zsh expert but I think all modifiers apply to history expansions too, so the modifier & should be also be highlighted in history-expansion.

@phy1729
Copy link
Member

phy1729 commented Jun 3, 2023

Looks like this is a zsh bug

printf '<%s>' ${(z)${:-'!-2:&'}}
<!-2:><&>

(That means the (z) PE flag is splitting the & into a separate token when it should be all one token.)

@zaidhaan
Copy link
Author

zaidhaan commented Jun 3, 2023

Looks like this is a zsh bug

Reported at https://zsh.org/workers/51819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants