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

Tab suggestions no longer working #90

Open
paulmist opened this issue May 3, 2024 · 7 comments
Open

Tab suggestions no longer working #90

paulmist opened this issue May 3, 2024 · 7 comments
Assignees

Comments

@paulmist
Copy link

paulmist commented May 3, 2024

I've been using the Z plugin with Oh My Zsh for years and suddenly the tab suggestions have disappeared.

Thanks in advance.

Here's my .zshrc file if that's of use:

export ZSH=$HOME/.oh-my-zsh

ZSH_THEME="awesomepanda"

# don't check for new mail
unset MAILCHECK
MAILCHECK=0

plugins=(git sublime macos z)

source $ZSH/oh-my-zsh.sh

# User configuration
export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"

. `brew --prefix`/etc/profile.d/z.sh

#MAMP Madness
export PATH=/Applications/MAMP/Library/bin:$PATH
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
export PATH="/usr/local/sbin:$PATH"
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
chruby ruby-3.0.3

ssh-add ~/.ssh/id_ed25519
@gBonvenuto
Copy link

I might have the same problem. It's my first time using this plugin and tab completion only shows options, not directories

@agkozak
Copy link
Owner

agkozak commented May 9, 2024

Try typing

which _z | less

and give me the first few lines of what it says. Thanks!

@agkozak agkozak self-assigned this May 9, 2024
@paulmist
Copy link
Author

paulmist commented May 9, 2024

Let me know if you need more. Thanks!

_z () {
        local datafile="${_Z_DATA:-$HOME/.z}"
        [ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
        if [ "$1" = "--add" ]
        then

@agkozak
Copy link
Owner

agkozak commented May 9, 2024

It looks as if you're not actually using Zsh-z, but rather rupa/z, which was the original z utility that shipped with Oh-My-Zsh. Oh-My-Zsh has been using Zsh-z since 2022. rupa/z doesn't seem to work with recent versions of Zsh, for some reason.

You'll want to upgrade your Oh-My-Zsh installation. Back up your $ZSH directory, if you want to. Then use

omz update

You might also want to

exec zsh

Then try using z with tab completion. If you want to check to be sure that the upgrade has been successful, you can use

which _z | less

again. The code returned should look like

_z () {
        emulate -L zsh
        (( ZSHZ_DEBUG )) && setopt LOCAL_OPTIONS WARN_CREATE_GLOBAL NO_WARN_NESTED_VAR 2> /dev/null
        local completions expl completion
        local -a completion_list
        completions=$(zshz --complete ${(@)words:1})
        [[ -z $completions ]] && return 1
        for completion in ${(f)completions[@]}

etc.

Let me know if that worked.

@paulmist
Copy link
Author

Thanks for your help.

I tried all of the above - but nothing worked. OMZ was already up-to-date.

However, I then found this line in my .zshrc file…

. `brew --prefix`/etc/profile.d/z.sh

Which I believe I added one time when z stopped working altogether.

I've removed that line, and all is working again.

@agkozak
Copy link
Owner

agkozak commented May 10, 2024

@paulmist I can't believe I missed that line! Glad you've got it fixed.

@gBonvenuto Want to check if you've got something similar going on? Try which _z | less and see what code comes up.

@gBonvenuto
Copy link

gBonvenuto commented May 11, 2024

Hello, thank you for mentioning me!

here's my which _z | less first lines:

_z () {
	local datafile="${_Z_DATA:-$HOME/.z}" 
	[ -h "$datafile" ] && datafile=$(readlink "$datafile") 
	[ -z "$_Z_OWNER" -a -f "$datafile" -a ! -O "$datafile" ] && return
	_z_dirs () {
		local line
		while read line
		do
			[ -d "${line%%\|*}" ] && echo "$line"
		done < "$datafile"
		return 0
	}
	if [ "$1" = "--add" ]
	then

I tried the steps of update omz, and it's still the same output

EDIT: seems like I'm also using rupa, because in my .oh-my-zsh/plugins/z/z.sh this is the first line:

# Copyright (c) 2009 rupa deadwyler. Licensed under the WTFPL license, Version 2

I think it might be worth mentioning I used to use zoxide before knowing there was this zsh plugin

EDIT 2: I've decided to just install it with git clone in my custom/plugins directory. Sorry for this roller-coaster lol

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

No branches or pull requests

3 participants