Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by
edited by

Hello,
I have the following code:

vifm --remote +':if filetype('.') == 'dir' | echo 'Directory' | else | echo 'File' | endif'

Unfortunately, it's not working. What am I doing wrong?
Output messages:

Invalid expression: filetype(.) == dir
Invalid expression: Directory
Misplaced :else
Invalid expression: File
:endif without :if

1 Answer

0 votes
by

You can change the outer quotes to double quotes:

vifm --remote +":if filetype('.') == 'dir' | echo 'Directory' | else | echo 'File' | endif"

If you're going to nest quotes, they need to be of a different kind or some kind of escaping is necessary.

ago by

Thank you very much.
Now it works very well.

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...