Solvedvoidrice Lf Jump function doesn't work

Hi. I spent a long time to fix this but it's weird.

In lfrc we have this line

map J $lf -remote "send $id cd $(cut -d'	' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | fzf)"

And i don't know if for you it works but for me i get an error saying that the directory doesn't exist. I tried to play with it a bit and got it to work when using full path "/home/user/etc..". But i can't seem to make it work with enviromental variables. Not even with $HOME.

There is a mistake with the cut -d' ' because the delimiter is sometimes one space sometimes two or three so i added a | rev | cut -d' ' -f1 | rev at the end for testing. The main problem is that the cd doesn't work with enviromental variables.

This would be a cool feature to fix. Thanks.

20 Answers

✔️Accepted Answer

Oh looks like it's more common than i thought.

I came to the same conclusion, it's just cd that won't accept the enviromental variables.
I didn't tried eval so I will take a look but I think a cool solution would fix the cd issue, it has to be something external but i don't have any idea what it may be. Do you have artix linux aswell?
I just ignored the enviromental variables and wrote a sed command to replace every XDG or $HOME variable with ~. So it is more of a patch than a real solution.

Here is the sed command if you need it.

sed 's/\${.*\://;s/\-\$HOME/~/;s/$HOME/~/;s/}//'

If you find out anything else write here it would be amazing to fix it. I will open the issue again since there is more people with the problem

Edit: Ohh I forgot, to fix lf only recognizing some lines i made a rev | cut -d | rev. So the complete line looks like this now. I could optimize it a bit changing the first cut -d that really is extra but as it is just temporary screw it.

map J $lf -remote "send $id cd $(cut -d'	' -f2 ${XDG_CONFIG_HOME:-$HOME/.config}/directories | sed 's/\${.*\://;s/\-\$HOME/~/;s/$HOME/~/;s/}//' | fzf | rev | cut -d' ' -f1 | rev  )"

Other Answers:

Well i made a temporary fix with sed so i will close this for now to avoid making the issue page too long. Looks like this is a rare issue and i didn't found any info about it, so i will just resignate and use it like this. Probably is some misconfig or something dumb. Thank you all for trying.

Related Issues:

voidrice Without proper default fonts, emojis crash st
For anyone ending up here I found a very hacky solution to avoid crashes in st (LukeSmithxyz/st#37):...
voidrice Lf Jump function doesn't work
Oh looks like it's more common than i thought I came to the same conclusion it's just cd that won't ...