this post was submitted on 21 Sep 2024
329 points (99.1% liked)

Open Source

30416 readers
483 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 5 years ago
MODERATORS
 

Can't imagine using my system without this.

you are viewing a single comment's thread
view the rest of the comments
[–] thingsiplay@beehaw.org 3 points 1 day ago* (last edited 17 hours ago) (1 children)

Yes, it's a simple shell function; needs to be a function in your bashrc, not a script, because cd doesn't work like that. Just copy the function from https://yazi-rs.github.io/docs/quick-start#shell-wrapper into your .bashrc:

EDIT: I forgot that Beehaw will replace the ampersand character to &. So instead copying my code you should copy it from the link above.

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

I use yy instead single y.

[–] Eyck_of_denesle@lemmy.zip 2 points 17 hours ago (1 children)

Thank you so much for taking the time to post it. I will add this asap.

[–] thingsiplay@beehaw.org 2 points 17 hours ago* (last edited 17 hours ago)

I forgot that Beehaw will replace the ampersand character to &. So instead copying my code you should copy it from the link above.