yorukot / superfile

Pretty fancy and modern terminal file manager
https://superfile.netlify.app
MIT License
5.66k stars 126 forks source link

CD on quit fish shell #183

Closed EliteAMDGamer closed 1 month ago

EliteAMDGamer commented 4 months ago

I might have the code wrong as I've never converted syntax over but getting an error with it on fish shell

So maybe a little added to the doc for fish shell

function spf
    set os (uname -s)

    # Linux
    if test "$os" = "Linux"
        echo "hello"
        set -gx SPF_LAST_DIR "$XDG_STATE_HOME/superfile/lastdir" "$HOME/.local/state/superfile/lastdir"
    end

    command spf $argv

    if test ! -f "$SPF_LAST_DIR"
        source "$SPF_LAST_DIR"
        rm -f -- "$SPF_LAST_DIR" > /dev/null
    end
end

with the error being

source: Error encountered while sourcing file ''/superfile/lastdir /home/User1/.local/state/superfile/lastdir'':
source: No such file or directory
yorukot commented 4 months ago

@EliteAMDGamer Thanks for the code!! Have you tested this?

EliteAMDGamer commented 4 months ago

@EliteAMDGamer Thanks for the code!!

Have you tested this?

I have I would say it's not quite working hopefully somebody smarter than me can chime in on how it should be.

yorukot commented 4 months ago

Understood! Sorry for the misunderstanding! I'm not a fish shell user so I may not be able to help with this :(

Good1Cheese commented 2 months ago

Here is working code:

function spf
    set -gx SPF_LAST_DIR "$HOME/.local/state/superfile/lastdir"

    superfile $(pwd)

    if test -f "$SPF_LAST_DIR"
        source "$SPF_LAST_DIR"
        rm -f -- "$SPF_LAST_DIR" > /dev/null
    end
end
yorukot commented 1 month ago

Looks like it has been resolved I will close it for now.