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
edited by

please what is the correct way to do a loop that works reliably with files containing spaces, "(" etc. this is not working as expected:

command! mycmd
        \ :execute "!!for i in %f; do echo $i; echo '===='; done"

thank you! jose

1 Answer

0 votes

Double percent sign like this:

command! mycmd
       \ :execute "!!for i in %%f; do echo $i; echo '===='; done"

This will postpone expansion of the macro until running :execute instead of doing it before invoking :execute.


thank you, it works, but not if you

  • select files
  • run :command
  • select mycmd and run it

looks like just before running it the selection is cancelled. could you please check?


Yeah, I confirm that selection isn't preserved. Thanks.

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.

Support Ukraine