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

sudden zstyle issues with zoxide 0.9.4 #729

Closed
dannysteenman opened this issue Feb 21, 2024 · 5 comments · May be fixed by marlonrichert/zsh-snap#277 or marlonrichert/zsh-snap#278
Closed

sudden zstyle issues with zoxide 0.9.4 #729

dannysteenman opened this issue Feb 21, 2024 · 5 comments · May be fixed by marlonrichert/zsh-snap#277 or marlonrichert/zsh-snap#278

Comments

@dannysteenman
Copy link

dannysteenman commented Feb 21, 2024

I've installed the latest release (0.9.4) today and suddenly my fzf-preview stopped working for zoxide on the latest macOS.

This is my configuration in .zshrc file:

zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'eza -1lh --icons --git-ignore --group-directories-first --sort=accessed --color=always $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-flags --height=35% --preview-window=right:65%

... <more settings here>


eval "$(zoxide init --cmd cd zsh)"

fzf version: 0.46.1 (brew)
macOS 14.3.1 23D60 arm64
zsh 5.9

@ajeetdsouza
Copy link
Owner

Could you link me to fzf-preview? I'm not familiar with it.

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Feb 21, 2024
@dannysteenman
Copy link
Author

Could you link me to fzf-preview? I'm not familiar with it.

Sure! it's part of fzf-tab, see docs: https://github.com/Aloxaf/fzf-tab/wiki/Preview

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label Feb 21, 2024
@ajeetdsouza
Copy link
Owner

That's because cd is no longer an alias of __zoxide_z. Try directly enabling it for cd:

zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1lh --icons --git-ignore --group-directories-first --sort=accessed --color=always $realpath'
zstyle ':fzf-tab:complete:cd:*' fzf-flags --height=35% --preview-window=right:65%

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Feb 21, 2024
@dannysteenman
Copy link
Author

@ajeetdsouza that worked, thank you!

Since you mentioned that cd is no longer an alias, I got some issues with cd when using for example znap (https://github.com/marlonrichert/zsh-snap).

when I run znap pull or znap status, zoxide is giving error messages which didn't occur in the previous version of zoxide 0.9.3.

error:

❯ which cd
cd () {
   __zoxide_z "$@"
}
❯ znap status
Aloxaf/fzf-tab zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
zoxide: no match found
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
✓
junegunn/fzf ✓
paulirish/git-open fatal: not a git repository (or any of the parent directories): .git
✓
romkatv/powerlevel10k ✓
zdharma-continuum/fast-syntax-highlighting ✓
zsh-snap ✓
zsh-users/zsh-autosuggestions ✓
zsh-users/zsh-completions ✓
zsh-users/zsh-history-substring-search ✓

source of the znap status command which uses the cd command: https://github.com/marlonrichert/zsh-snap/blob/755566ca73bfe3cc229fe90fcc0ba87d58325771/functions/.znap.status#L26

Example of how I currently configured zoxide in my .zshrc:

eval "$(zoxide init --cmd cd zsh)"

What seems to solve the issue for now is if I initialize zoxide without the --cmd cd argument and then create an alias for z to cd:

alias cd=z
alias cdi=zi

Then znap status works again:

❯ which cd
cd: aliased to z
❯ znap status
Aloxaf/fzf-tab v1.0 ✓
junegunn/fzf ✓
paulirish/git-open ✓
romkatv/powerlevel10k ✓
zdharma-continuum/fast-syntax-highlighting ✓
zsh-snap ✓
zsh-users/zsh-autosuggestions ✓
zsh-users/zsh-completions ✓
zsh-users/zsh-history-substring-search ✓

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label Feb 22, 2024
@ajeetdsouza
Copy link
Owner

There isn't much we can do from our end to prevent this - cd has been overridden, and znap is calling the overridden cd command.

I've created a PR on znap's repo to fix the way they call cd, which should fix the issue: marlonrichert/zsh-snap#277

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