ajeetdsouza / zoxide

A smarter cd command. Supports all major shells.
MIT License
22.07k stars 537 forks source link

Fish cd aliasing #731

Closed Warningrobert closed 7 months ago

Warningrobert commented 7 months ago

The following is my fish config:

`if status is-interactive

Commands to run in interactive sessions can go here

end

alias ls='eza' alias ll='eza -la' alias cat='bat'

zoxide init fish | source

alias cd='z' ` When I run cd, it outputs the following:

fish: The call stack limit has been exceeded. Do you have an accidental infinite loop? function cd --wraps z --description 'alias cd=z'; z $argv ^ in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' in function '__zoxide_cd_internal' with arguments 'conf.d/' called on line 23 of file - in function '__zoxide_cd' with arguments 'conf.d/' called on line 55 of file - in function '__zoxide_z' with arguments 'conf.d/' called on line 1 of file - in function 'z' with arguments 'conf.d/' The actual output is a lot longer but it's repeating the same thing.

My zoxide version is 0.9.4.

I've read that this issue is fixable by putting the alias after the init of zoxide in the fish config but it clearly doesn't work.

First time posting a github issue. Anything else that I should add?

ajeetdsouza commented 7 months ago

Try using this:

zoxide init --cmd cd fish | source
OhMyVolk commented 7 months ago

Try using this:

zoxide init --cmd cd fish | source

This worked for me, thanks!

Warningrobert commented 7 months ago

Try using this:

zoxide init --cmd cd fish | source

Works! Thanks.

aljustiet commented 3 months ago

But the z doesn't work anymore.

22ispencer commented 2 weeks ago

@aljustiet the --cmd flag defaults to z when you change it to cd then zoxide doesn't create the z command and instead overwrites cd

ajeetdsouza commented 2 weeks ago

@aljustiet on zoxide v0.9.5, you should be able to create an alias without running into the earlier issues.