CD on quit fish shell
EliteAMDGamer opened this issue · comments
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
@EliteAMDGamer Thanks for the code!!
Have you tested this?
@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.
Understood! Sorry for the misunderstanding!
I'm not a fish shell user so I may not be able to help with this :(
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
Looks like it has been resolved I will close it for now.