Your :let
code is probably from a mapping and macros aren't expanded in the body of mappings. They are expanded on a per command basis (e.g., for :!
and :touch
) and in the body of user defined commands.
Right hand side of :let
command is an expression, so you can use expand()
function, otherwise you would need to use expand()
and :execute
command.
This should work:
:let $FZF_RES = term("fd -t d '' ".expand('%d')." | fzf 2> /dev/tty")
\| if $FZF_RES != ''
\| cd $FZF_RES
\| endif
You can test such things with :echo
:
:echo expand('%d')