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

change directory on quit with zoxide does not work #978

Closed
alaymari opened this issue Apr 30, 2024 · 3 comments
Closed

change directory on quit with zoxide does not work #978

alaymari opened this issue Apr 30, 2024 · 3 comments
Labels
invalid This doesn't seem right

Comments

@alaymari
Copy link

What system are you running Yazi on?

Linux X11

What terminal are you running Yazi in?

terminator

Did you try the latest code to see if this problem got fixed?

Tried, but the problem still

yazi --debug output

Yazi
    Version: 0.2.5 (c65a14c 2024-04-23)
    OS: linux-x86_64 (unix)
    Debug: false

Emulator
    Emulator.via_env: ("xterm-256color", "")
    Emulator.via_csi: Ok(Unknown([]))
    Emulator.detect: Unknown([])

Adaptor
    Adaptor.matches: X11

Desktop
    XDG_SESSION_TYPE: Some("x11")
    WAYLAND_DISPLAY: None
    DISPLAY: Some(":0")

SSH
    shared.in_ssh_connection: false

WSL
    /proc/sys/fs/binfmt_misc/WSLInterop: false

Variables
    SHELL: Some("/usr/bin/zsh")
    EDITOR: Some("nvim")
    ZELLIJ_SESSION_NAME: None
    YAZI_FILE_ONE: None
    YAZI_CONFIG_HOME: None

file(1)
    Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "file-5.45\nmagic file from /etc/magic:/usr/share/misc/magic\n", stderr: "" })

Text Opener
    default: Some(Opener { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })
    block: Some(Opener { run: "$EDITOR \"$@\"", block: true, orphan: false, desc: "$EDITOR", for_: None, spread: true })

tmux
    TMUX: false

Ueberzug++
    Version: Ok(Output { status: ExitStatus(unix_wait_status(0)), stdout: "ueberzugpp 2.9.2\n", stderr: "" })


--------------------------------------------------
When reporting a bug, please also upload the `yazi.log` log file - only upload the most recent content by time.
You can find it in the "/home/xyz/.local/state/yazi" directory.

Describe the bug

I have defined the function y for invoking yazi so as to change directory on quit as mentioned in the docs.

I have also changed the z command of zoxide to cd via

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

With the above set up, yazi does not change directory on quit. I get

zoxide: no match found

If I have,

eval "$(zoxide init zsh)"

things work as expected.

Is there a way to make yazi follow the changes to zoxide invocation?

Expected Behavior

On quit, yazi should change to the directory it is in.

To Reproduce

Just changing the zoxide command will reproduce the bug.

Configuration

Default config. No changes.

Anything else?

No response

@alaymari alaymari added the bug Something isn't working label Apr 30, 2024
@sxyazi
Copy link
Owner

sxyazi commented Apr 30, 2024

If you use the shell wrapper then it simply executes the cd command through your shell when yazi exits, it looks like zoxide has changed the behavior of cd, I don't think this is a yazi bug.

Closing as not Yazi and I'm not sure what Yazi can do here

@sxyazi sxyazi closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
@sxyazi sxyazi added invalid This doesn't seem right and removed bug Something isn't working labels Apr 30, 2024
@wiraki
Copy link

wiraki commented May 11, 2024

Just for reference, here's a related issue in zoxide's repo. Unfortunately it has not been addressed.

Edit:
A possible work-around it to adjust the yy wrapper by removing the --, like so:

function yy() {
	local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
	yazi "$@" --cwd-file="$tmp"
	if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
		cd "$cwd"
	fi
	rm -f -- "$tmp"
}

I also have not tested it very thoroughly and I am not sure about possible side-effects of doing this, please let me know.

Copy link

I'm going to lock this issue because it has been closed for 30 days. ⏳
This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants