Welcome to Vifm Q&A, where you can ask questions about Vifm usage. Registration is optional, anonymous posts are moderated. GitHub or Google logins are enabled.
0 votes
in vifm by

How can I find out if a text (coming from fzf) is file or folder? I am using below code from wiki and would like to customize it to do different operation depending on whether a file is chosen or a folder?

Thank you

command! FZFlocateC : set noquickview
                  \| let $FZF_PICK = term('locate $HOME | fzf 2>/dev/tty')
                  \| if $FZF_PICK != ''
                  \|     execute 'goto' fnameescape($FZF_PICK)

1 Answer

+1 vote
selected by
Best answer

You'll have to use an external command for this:

if system("test -d $FZF_PICK && echo dir") == 'dir'
    " handle dir
    " handle file