Fasd: How does interactive mode work?

Created on 23 Jun 2019  ·  12Comments  ·  Source: clvv/fasd

I've installed on my mac and use s tools, which returns a list of results and then a prompt, a bit like this:

2   15         /Users/moi/some/path/tools
1   32.3401    /Users/moi/another/path/somewhere/else/tools
>

I'm guessing the prompt expects one of the numbers on the left. I enter 1, but it doesn't not switch folder. I've also entered z 1 and cd 1 at the prompt, neither works either.

Is my usage correct but it's not working properly on my machine? Or am I entering the wrong thing? There doesn't seem to any documentation on how it works.

All 12 comments

Trying to understand this, https://github.com/clvv/fasd/blob/master/fasd#L603 - is it meant to just print out the path when I enter a number?

elif [ "$interactive" ] || [ "$exec" -a -z "$fnd$lst$show" -a -t 1 ]; then
      if [ "$(printf %s "$res" | sed -n '$=')" -gt 1 ]; then
        res="$(printf %s\\n "$res" | sort -n${R})"
        printf %s\\n "$res" | sed = | sed 'N;s/\n/  /' | sort -nr >&2
        printf "> " >&2
        local i; read i; [ 0 -lt "${i:-0}" ] 2>> "$_FASD_SINK" || return 1
      fi
      res="$(printf %s\\n "$res" | sed -n "${i:-1}"'s/^[^ ]*[ ]*//p')"

Closest usable workaround I could come up with is s | xargs cd, but it's not ideal as it fails if there's a space in the path. I feel like the interactive mode prompt should behave a bit like z?

the alias you want is zz. it's mentioned in the README.

Interactive frecency cd, I implemented on
fzf-extra.sh/_zz()

2019年7月21日(日) 11:24 aasril notifications@github.com:

the alias you want is zz. it's mentioned in the README.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/clvv/fasd/issues/141?email_source=notifications&email_token=AD5GCVATNZPVODYQELZRSWTQAPCE3A5CNFSM4H2XWRSKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2NZRLY#issuecomment-513513647,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD5GCVCXLXKH6P7HS73EA7LQAPCE3ANCNFSM4H2XWRSA
.

Ok, thanks very much.

I was also using fzf as a workaround for the fact that interactive mode does not work on my system.

Adding | fzf (and whatever fzf argument one likes) at the end of any fasd command allows for interactive selection.

@sypl: I think that you should re-open this issue. @u1and0 suggested a nice workaround with an outside tool making use of fzf, but that does not solve the fact that the interactive mode of fasd does not run on some systems as it should (including yours and mine).

@prosoitos What is the intended behaviour of the s command? Is it meant to cd and open up file/folders I select from the result list? And does it do that in other OSs? If so then yes, this isn't working and I'd probably want to reopen this. But if it's just a listing search then it's working as intended.

Oh yes. That's what s does. I had not read your post properly and got mislead by your title. s has nothing to do with interactive mode and with your title, I thought that you were referring to the i flag (interactive mode).

So yes, the behaviour you are describing with fasd -s is normal. My problem is that fasd -i does not work on my system and I thought that it was your problem too.

Well, actually, no: you should not get a prompt when using fasd -s. You should get a list with their weight values.

So, only this:

15         /Users/moi/some/path/tools
32.3401    /Users/moi/another/path/somewhere/else/tools

What you are showing looks like the result of fasd -i -s which is the interactive version of fasd -s.

If you type a number at the prompt and Return, you should get the path and weight value of the corresponding line as an output.

And if you wanted to cd to that path, as @aasril pointed out, the alias is zz which stands for fasd_cd -d -i. Except for me, for some reason, the interactive versions don't work. But the problem is likely on my end since nobody else complained about that.

Sorry I got confused by your post. And it seems that indeed, you should not re-open the issue. You were simply not using the proper fasd command.

And I owe an apology to @aasril for my unfair and misguided thumb down (which I will remove right away) as his answer was totally adequate and I was the one in the wrong since I had not read your post closely enough and got blinded by your title + my own problem with interactive mode (I had not realized that you were using the wrong command and I thought that you were getting a wrong behaviour from the right command. My bad for not reading carefully :worried: *feeling ashamed*).

Oh, and now I realize what you were referring to when you talked of the s tool: there is an s alias which stands for fasd -i -s. So then yes, the behaviour you are observing when using s is perfectly normal. It is simply the interactive mode to list your entries. It is not supposed to cd to your selection.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ·  12Comments

sbglasius picture sbglasius  ·  5Comments

rosshadden picture rosshadden  ·  6Comments

ixil picture ixil  ·  5Comments

rendybjunior picture rendybjunior  ·  14Comments