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

I want to make an action on an archive file to extract it into specified directory

filetype {*.zip,*.nupkg,*.jar,*.war,*.ear,*.oxt,*.apkg},
        \<application/zip,application/java-archive>
        \ {Extract here}
        \ tar -vxf %c,
        \ {Extract there}
        \ mkdir "%a" | tar -vxf %c -C "%a"

but did not find any way to ask user for an input.
Is there a way to for example show a popup "window" with input field?

Thanks!

1 Answer

+1 vote
by
selected by
 
Best answer

input() function was added in v0.13, but you can't use functions in :filetype (well, unless you'll implement handler in Lua, which can invoke vifm.input() and that should work).

However, user-defined :command is usually more appropriate for such things:

command! extract : let $DIR_NAME = input('mkdir: ', '', 'dir')
                \| if $DIR_NAME != ''
                \|     execute '!mkdir' fnameescape($DIR_NAME) '&& tar -vxf %%c:p -C' fnameescape($DIR_NAME)
                \| endif

Although in this case using %a and running :extract dirname seems easier and maybe you have a reason to use :filetype.

...