Closed kredati closed 4 months ago
Could you share your shell configuration?
Could you share your shell configuration?
Not OP but I am having the same issue. I installed zoxide last night and it was working great, I even aliased it to cd. Came to work today and booted up my laptop, now any z
command returns this stack limit exceeded error.
I'm also using Fish, but on Linux.
What exactly config is it you need? config.fish?
Update: I removed the cd=z alias and now it doesn't happen. Does z use cd underneath perhaps?
Here is my config.fish
:
if status is-interactive
# Commands to run in interactive sessions can go here
end
function rga-fzf
set RG_PREFIX 'rga --files-with-matches'
if test (count $argv) -gt 1
set RG_PREFIX "$RG_PREFIX $argv[1..-2]"
end
set -l file $file
set file (
FZF_DEFAULT_COMMAND="$RG_PREFIX '$argv[-1]'" \
fzf --sort \
--preview='test ! -z {} && \
rga --pretty --context 5 {q} {}' \
--phony -q "$argv[-1]" \
--bind "change:reload:$RG_PREFIX {q}" \
--preview-window='50%:wrap'
) && \
echo "opening $file" && \
open "$file"
end
zoxide init fish | source
thefuck --alias | source
# set fzf file completion to option-tab
fzf_configure_bindings --directory=\e\t
# starship init fish | source
As @asjur notes: actually, the issue seems to lie entirely in the cd=z
alias. I was able to cause the issue by alias --save cd=z
, and fix the issue by deleting ~/.config/fish/functions/cd.fish
.
I should say, one wrinkle is that the shell in which you alias --save cd=z
works just fine, with cd
aliasing z
no problem. But in a new shell where the fish function runs at startup, that's when the stack overflow shows up.
So if you add alias cd=z
in config.fish, you're good to go (although it breaks fish's syntax highlighting), whereas if you have a function file, cd.fish, with the following, you get the stack overflow:
function cd --wraps=z --description 'alias cd=z'
z $argv
end
Have you tried initializing zoxide as cd
instead of z
?
zoxide init fish --cmd cd | source
Also, do verify that your zoxide version is up-to-date (may be a duplicate of https://github.com/ajeetdsouza/zoxide/issues/694):
$ zoxide -V
zoxide 0.9.3
I had the exact same problem, and can confirm that update fixes the error. Ubuntu repo has 0.4.3 version of zoxide and updating manually helps.
@kredati do update to the latest version of zoxide. Ubuntu / Debian derivatives have a very outdated version. You may want to use the install script:
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
Have you tried initializing zoxide as
cd
instead ofz
?zoxide init fish --cmd cd | source
Also, do verify that your zoxide version is up-to-date (may be a duplicate of #694):
$ zoxide -V zoxide 0.9.3
Aliasing using this command is what fixed it for me.
@kredati do update to the latest version of zoxide. Ubuntu / Debian derivatives have a very outdated version. You may want to use the install script:
curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | bash
I am using MacOS (14.3.1), and installed zoxide using brew. Current version is 0.9.4 (updated from 0.9.3 just now). Stack overflow persists when using fish's alias
.
I do think that using alias
instead of changing the init line in fish.config
is an extremely normal thing to expect to be able to do with "new unix" tools like z
. (E.g., I map eza
to ls
with alias --save ls=eza
.)
If this isn't a bug to y'all, I get it. From a user's perspective, this feels like unexpected behaviour. Perhaps a note in the documentation under the "config" section would be appropriate.
Thanks for this! I love zoxide, and am grateful for everybody's work on it.
@kredati that's a reasonable ask. However:
cd
is provided by the shell, and zoxide
needs to use it internally to change the directory.builtin cd
directly (and avoid the infinite loop problem), but on Fish, the builtin is wrapped with a function that we need to use.
Updated to MacOS 14.3 last night. Currently running Zoxide 0.9.2, installed with Homebrew (4.2.5), in Fish (3.7.0), in Kitty (0.32.1). (I also upgraded Kitty today.)
Anytime I use
z
(with any, or no, arguments), I get:Note that indeed
meta
is correctly resolved to~/git/meta
. (~
redacted for privacy reasons;z
correctly lists the absolute path.)I moved
~/Library/Application Support/zoxide/db.zo
todb.zo.old
, and it's still giving me the stack overflow. I also uninstalled and reinstalled Zoxide withbrew
.Any help would be appreciated!