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

Can i archive selected files in vifm?

1 Answer

+1 vote
by

For example, you can define zip command in your vifmrc file (the check is to do nothing if you forget to specify name):

command! zip if [ -n "%a" ]; then
           \     zip -r '%a.zip' %f;
           \ fi

Then do the selection and run

:zip archive-name
by
edited by

Just to expand this based on issue 709

Here is a version that archives:

  • all selected files to %a.zip if %a is provided
  • all selected files to directory_name.zip if no %a is provided and multiple files are selected
  • the current file to file_name.zip if a single file is selected or no file is selected.
command! zip if [ -n "%a" ]; then
           \     zip -r '%a.zip' %f;
           \ elseif [ "%c" = "%f" ]; then
           \     zip -r %c.zip %c;
           \ else
           \     zip -r %d:t.zip %f;
           \ fi
by

Changed %c == %f to "%c" = "%f" or it probably won't work due to comparing one value to many.

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