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

Custom alias function combining exa and zoxide #623

Closed
JxJxxJxJ opened this issue Sep 19, 2023 · 6 comments
Closed

Custom alias function combining exa and zoxide #623

JxJxxJxJ opened this issue Sep 19, 2023 · 6 comments

Comments

@JxJxxJxJ
Copy link

JxJxxJxJ commented Sep 19, 2023

Hi. I've been trying to make the following function work

function cs () {
    z "$@" && exa --color=auto --icons --group-directories-first -a
  }
alias cd='cs'

the problem is the following

image

I installed zoxide but somehow the command z is not recognized

@ajeetdsouza
Copy link
Owner

Did you follow the installation instructions?

@ajeetdsouza ajeetdsouza added the waiting-for-response Waiting for a response from the issue author. label Sep 19, 2023
@JxJxxJxJ
Copy link
Author

I installed it and have eval "$(zoxide init zsh)" on my ~/.zshrc as well yes

@github-actions github-actions bot removed the waiting-for-response Waiting for a response from the issue author. label Sep 19, 2023
@ajeetdsouza
Copy link
Owner

There's very likely an issue with your configuration - either eval "$(zoxide init zsh)" is not being called or it's being overwritten by some other command. If you could share your config files, I could take a look.

@JxJxxJxJ
Copy link
Author

JxJxxJxJ commented Sep 20, 2023

Probably, thank you for your help. My config is the following:

First in ~/.zshenv I have

ZDOTDIR="$HOME/.config/zsh"

# vim:ft=zsh
. "$HOME/.cargo/env"

Then that zsh folder looks like this
image
And in options.zsh I had

command -v zoxide &>/dev/null && eval "$(zoxide init zsh)"

note that I tested with both

command -v zoxide &>/dev/null && eval "$(zoxide init zsh)"

and just eval "$(zoxide init zsh)".

Another thing I think it's worth mentioning is that I have the z command working, it's just when trying to do the alias that it doesn't recognize it. In alias.zsh I have

function cs () {
    z "$@" && exa --color=auto --icons --group-directories-first -a
  }
alias cd='cs'

And this shows the following behaviour
image

I can go from ~/Descargas -> ~/Documentos without problems with z, but not with cd aliased as shown. I believe it might have to do with the alias function?

@ajeetdsouza
Copy link
Owner

Try aliasing to __zoxide_z instead of z. Does it work then?

@JxJxxJxJ
Copy link
Author

JxJxxJxJ commented Oct 8, 2023

It works, yes. Thank you

@JxJxxJxJ JxJxxJxJ closed this as completed Oct 8, 2023
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

2 participants