ohmyzsh icon indicating copy to clipboard operation
ohmyzsh copied to clipboard

z plugin tab completion doesn't work in zsh 5.9

Open ricpelo opened this issue 2 years ago • 13 comments

Describe the bug

Using Debian testing (bookworm), fully updated as of today.

Using z plugin with Oh-My-Zsh doesn't work. When I type z (+ Space) and then press the Tab key, instead of shows the most frequent directories, it shows the following output:

Captura de pantalla_2022-06-04_15-54-52

However, when I use the z plugin without Oh-My-Zsh (i.e. only using Zsh and then source ~/.oh-my-zsh/plugins/z/z.zsh, it works OK:

Captura de pantalla_2022-06-04_15-59-51

Steps to reproduce

  1. Enable plugin z.
  2. Type z + press Space + press Tab key.

Expected behavior

It shows the most frequent directories and I can select one using the Tab key.

Screenshots and recordings

No response

OS / Linux distribution

Debian testing (bookworm)

Zsh version

zsh 5.9 (x86_64-debian-linux-gnu)

Terminal emulator

Alacritty

If using WSL on Windows, which version of WSL

No response

Additional context

No response

ricpelo avatar Jun 04 '22 14:06 ricpelo

At least in my case, the incorrect completions are coming from:

local/share/zsh/5.8.1.1-dev/functions/_compadd

which suggests the issue isn't with OMZ directly, but OMZ's use of compadd that triggers the problem.

rwmitchell avatar Jun 04 '22 15:06 rwmitchell

OMZ does not use compadd to change the z completion. It doesn't do anything extra apart from calling compinit. When that is done in a non-OMZ shell with zsh 5.9, the bug appears again.

It looks like there's an incompatibility with how z uses compctl instead of compsys and zsh 5.9. I'm still investigating.

mcornella avatar Jun 05 '22 15:06 mcornella

oh-my-zsh uses rupa's Z, right?

Not sure whether or not rupa is willing to make it compatible with newer ZSH versions, however, this gentlemen made it compatible: https://github.com/agkozak/zsh-z

I'm using it for a little bit and seems to be working fine with zsh 5.9.

Given rupa isn't a fan of ZSH (see issue 100 if curious) perhaps this version above is the best choice atm.

rodhash avatar Jun 07 '22 18:06 rodhash

It looks really interesting, it's probably an option to change to that!

carlosala avatar Jun 07 '22 22:06 carlosala

I've just tried the @rodhash' solution and it works very well! Like @carlosala said, to me it could be great if rupa/z would be replaced by agkozak/zsh-z.

ricpelo avatar Jun 08 '22 10:06 ricpelo

Yeah, also cool that he reports to have native ZSH support, so, sounds a good deal to me .. if you wish I'd be happy to contribute w/ a PR ..

I just need to fix my PC, I messed up my grub so I'm dual booting to fix it

rodhash avatar Jun 08 '22 12:06 rodhash

Oh grub issues... Good luck with that!

carlosala avatar Jun 08 '22 14:06 carlosala

Yeah, I was experimenting with a new distro and something weird messed my grub in the process .. now it's good again.

So you guys think it's a good idea to replace z completely or just add the zsh-z (keeping z for whatever reason)? I haven't yet read the contributing.md, will check that out.

In my local repo I just added zsh-z and seems to be working fine (inside plugins and not custom/plugins).

rodhash avatar Jun 09 '22 09:06 rodhash

@rodhash Both options looks good to me, but I prefer replacing z completely, as one of its main functionality simply doesn't work and it's a tested and working alternative.

ricpelo avatar Jun 09 '22 10:06 ricpelo

Could you test #10983 to check if it's working properly? You can do it with omz pr test 10983.

carlosala avatar Jun 09 '22 21:06 carlosala

it seems fine .. will keep it running as my daily driver Z till this PR is merged

rodhash avatar Jun 13 '22 11:06 rodhash

I'm glad my Zsh-z plugin solves your problem. Let me know if you have any questions about it.

agkozak avatar Jun 13 '22 17:06 agkozak

Hello, sir!

Awesome job! I'm happy oh-my-zsh folks accepted your plugin as a replacement for z :)

I'm glad my Zsh-z plugin solves your problem. Let me know if you have any questions about it.

rodhash avatar Jun 13 '22 21:06 rodhash