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

I'm currently using a filextype configuration that execute a system command that uses vifm %d macro.
Would be possible to replace the %d with a macro that reference the current custom view if file is executed from such custom view?
For the system command to interact with custom view files like this, should a temporary directory be created with custom view files symlinked inside it?

1 Answer

0 votes
by
selected by
 
Best answer

When inside of a custom view, %d is expanded to the root of the view which may not correspond to the directory where a file is located. Which directory path do you want to get in the end? If it's where the file is, %c:p:h should do, but the way you describe it is as if you want %d exactly how it's expanded. Please clarify.

by

in the end I want to get a path of the custom view itself, as if it was a real filesystem directory with all custom view's file inside as if they were symlinked inside this directory . Could such a temporary directory structure be created on filesystem, so I can feed its path and content to my filextype system command?

by

Oh, so you don't need a macro, you need to instantiate custom file list on a file-system.

First thing to note is that :filextype won't get the whole list of files unless you select everything and use %f macro, so a custom :command may fit better. Although, Lua API can iterate over all files from a :filextype handler activated on a single file.

If your target application can accept list of files, you could do it this way. Otherwise, I think you're right in that this needs a bunch of symbolic links and maybe all intermediate directories to them, unless something like OverlayFS can be made to turn list of paths into a file-system. I think cp --symbolic-link --parents %f {tmpdir} may do it, Vifm doesn't really have means that would make the task easier.

by

the application do not accept a list of files but a dir path only. Your suggestion guided me on the right path and if I execute :alink /tmp/mydir on custom view file selection it correctly creates a list that the application can manage; I will build up a vifm shortcut from there, thank you <3

by

Mind that because :alink doesn't create intermediate directories it fails if file names aren't unique.

by

it's perfect for the scope, I need all those files at the same level of the temporary folder, thank you for caring <3

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.
...