romkatv / zsh4humans

A turnkey configuration for Zsh
MIT License
1.81k stars 116 forks source link

fix: Rename -z4h-comp-insert-all to z4h-comp-insert-all #240

Closed joshchoo closed 2 years ago

joshchoo commented 2 years ago

Previously _zsh_highlight_bind_widgets tries to add the -z4h-comp-insert-all widget using the following command (see reference for how that exactly looks like):

zle -N -z4h-comp-insert-all ...

However the "-" prefix on -z4h-comp-insert-all leads to the following error:

"_zsh_highlight_bind_widgets:zle:46: bad option: -z"

Rename -z4h-comp-insert-all to z4h-comp-insert-all to resolve the error.

Problem encountered on:

romkatv commented 2 years ago

What do I need to do to reproduce this error?

joshchoo commented 2 years ago

I can reproduce the error with the following steps:

$ docker run -it --rm archlinux bash

$ pacman -Sy

$ pacman -S zsh

$ pacman -S zsh-syntax-highlighting  # this is installed by default with some Linux distros
# installed to /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh4humans/v5/install)"
# set up zsh4humans however you like

$ exec zsh

$ source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

# _zsh_highlight_bind_widgets:zle:46: bad option: -z

It seems to be caused with a conflict with the zsh-syntax-highlighting package provided at https://github.com/zsh-users/zsh-syntax-highlighting. I could uninstall this package, but would like to check first if you're okay with renaming -z4h-comp-insert-all to fix the issue I encountered.

romkatv commented 2 years ago

Why do you run this command?

source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

What would be missing if you don't run it?

joshchoo commented 2 years ago

Why do you run this command?

source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

What would be missing if you don't run it?

By default, the above command is automatically run on Manjaro in one of the prepackaged zsh files. Would you recommend that I uninstall/remove these default zsh files instead of renaming "-z4h-comp-insert-all"?

romkatv commented 2 years ago

How can this error be reproduced without manually running source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh?

joshchoo commented 2 years ago

How can this error be reproduced without manually running source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh?

Right, I see what you mean. It looks like I'm preserving portions of the original .zshrc from the default Manjaro install:

if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then 
   source /usr/share/zsh/manjaro-zsh-config 
fi

The above causes the prepackaged zsh-syntax-highlighting to be sourced. Removing this prevents the issue from appearing.

Thanks for pointing me in the right direction, and appreciate you looking at the issue. I'll close this PR