I just discovered fzf (fuzzy finder) and now want to achieve the following using fd (https://github.com/sharkdp/fd): From the current directory find immediate parent directories of all files that match the string I typed as well as find directories whose name match the string I typed.
I tried doing cd "$(fd | fzf)" but the problem which occurs here is that for matching files fd | fzf will obviously output the full path to the file and not just to the parent directory meaning cd fails on this output. Is there a way of rectifying this without having to define separate commands for each of the above listed conditions?