Can’t imagine using my system without this.

  • thingsiplay@beehaw.org
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    3 months ago

    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.

      • thingsiplay@beehaw.org
        link
        fedilink
        arrow-up
        2
        ·
        edit-2
        3 months ago

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