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

Facing issue with simple bash alias: '_zsh_highlight_main__type:13: job table full or recursion limit exceeded' #943

Open Anatoli-deBRADKE opened 5 months ago

Anatoli-deBRADKE commented 5 months ago

Hello,

I have defined the following alias in my ~/.zshrc alias kubectl="kubectl --context \${KUBE_CONTEXT:-\$(command kubectl config current-context)}"

and after executing the following command line:

$ aws-vault exec aws-legacy-production

the following error message appears as soon as I have finish to write kubectl in my prompt

image

Do you have any idea of the origin of this issue?

Thanks in advance!

danielshahaf commented 4 months ago

Hi, I have no time to debug this right now, but you should be able to workaround by changing kubectl to ${:-kubectl} within the alias expansions (let's say both instances to be on the safe side).

Also, what version of z-sy-h and zsh are you running? Asking to see whether you have this https://github.com/zsh-users/zsh-syntax-highlighting/blob/e0165eaa730dd0fa321a6a6de74f092fe87630b0/highlighters/main/main-highlighter.zsh#L706-L707

alias kubectl="kubectl --context \${KUBE_CONTEXT:-\$(command kubectl config current-context)}"

Anatoli-deBRADKE commented 4 months ago

Hello @danielshahaf and thanks for your answer!

I'm sorry but i'm not sure to understand the proposed workaround, can you give me a little bit more details please? Thanks in advance!

I'm using the following version of packages: zsh 5.9 (arm-apple-darwin23.0.0) zsh-syntax-highlighting 0.8.0

danielshahaf commented 4 months ago

Try changing this:

alias kubectl="kubectl --context \${KUBE_CONTEXT:-\$(command kubectl config current-context)}"

to this:

alias kubectl="\${:-kubectl} --context \${KUBE_CONTEXT:-\$(command \${:-kubectl} config current-context)}"

Excuse brevity.

Anatoli-deBRADKE commented 4 months ago

No worries! Many thanks for the workaround, which works perfectly.