Using an fzf command like
command! FzfHere :execute 'cd' "'".term('fd -t d "" . | fzf 2> /dev/tty')."'"
nmap ÷ :FzfHere<CR>
There's a drawback that a cancelled fzf select will run the cd with no arguments, moving us back to home folder. What is a good way to approach this?
Can it be done with :if somehow? Or does it require functions?
If all else fails, here's a workaround I came up with:
command! FzfHere :execute 'cd' "'".term('fd -t d "" . | fzf 2> /dev/tty | xargs dot-if-empty')."'"
if [ $# -eq 0 ]; then
I see you have found issue #309 on GitHub with the following command:
command! fzf : let $FZF_RES = term('fzf 2>&0')
\| if $FZF_RES != ''
\| goto $FZF_RES
It doesn't work as expected or you asked the question before seeing it?
That exact one didn't work for me, as it turns out because of 2>&0 bit, so I've abandoned that answer somewhere along the road and forgot it exists. Changing it to 2>/dev/tty works! Thank you.