You are not logged in.

#1 2023-11-07 12:58:41

yxz
Member
Registered: 2023-11-07
Posts: 4

[SOLVED] zsh autocompletion fails with globalrcs in kitty

EDIT: Apparently only zsh instances in kitty misbehave now and maybe were also what was broken? Using alacritty, I cannot reproduce this problem (in a short timeframe though) in either the tty or alacritty now so definitly not zsh's fault maybe kitty's probably mine.

While writing this question, I managed to fix it by touching (as root) the missing files that zsh tries to read commands from (/etc/zsh/zshenv and /etc/zsh/zshrc) but now I am puzzled by why zsh breaks without these files. After touching the two files, removing /etc/zsh/zshenv and leaving a blank /etc/zsh/zshrc seems enough to fix the problem.

So apparently missing a /etc/zsh/zshrc would break some parts of zsh auto-completion (maybe there is some fallback that I didn't find?) while ~/.zshrc is still run (the prompt styles and other auto-completion aspects work).

I am going to still post this so hopefully someone else can find this helpful and hopefully someone have some idea why /etc/zsh/zshrc needs to exist.

Here is the original problem:
I wanted to have autocomplete with sudo and looking in ArchWiki,  It says to put

zstyle ':completion::complete:*' gain-privileges 1

in my .zshrc, but this only worked for login (zsh) shells both in tty or with zsh -f. If I launch zsh with no rcs at all and type in

zstyle ':completion::complete:*' gain-privileges 1
autoload -Uz compinit
compinit

the privilege escalation works fine. Launching with no globalrcs has the same effect which would seem to blame the global rcs in /etc but according to many sources including the ArchWiki, the zsh rc files cannot really be the culprit as I only have the single /etc/zsh/zprofile that sources /etc/profile which sources /etc/profile.d/*.sh and glancing though these, there are not (and shouldn't have) any zsh related items (and commenting out the online in /etc/zsh/zprofile and starting a new instance stills leaves zsh broken). (another cause could be an incorrect $ZDOTDIR that made zsh read another .zshrc that breaks auto-completion)

Last edited by yxz (2023-11-07 13:24:18)

Offline

#2 2023-11-07 14:52:40

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,068

Offline

#3 2023-11-07 15:02:18

icewolf0110
Member
Registered: 2023-11-04
Posts: 15

Re: [SOLVED] zsh autocompletion fails with globalrcs in kitty

I will just drop the solution that solved the problem which seth had given:

"It was nothing related to zsh, it was kitty terminal setting an alias to sudo. I just needed to configure `shell_integration no-sudo` in kitty.conf and everything works well."

Offline

#4 2023-11-09 02:52:32

yxz
Member
Registered: 2023-11-07
Posts: 4

Re: [SOLVED] zsh autocompletion fails with globalrcs in kitty

Thanks for the quick reply, I was able to solve it turning off shell integration.

Offline

Board footer

Powered by FluxBB