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

How to load the contents of a file into a register (I wrote a file list there using :!echo %rx)?

1 Answer

+1 vote
by

There is no easy way to do this, only by using custom views as in the following command:

command readreg : execute '!cat %%c%%U'
               \| normal "%ayah

The command:

  1. Loads unsorted custom view (no need to sort for a register) (execute '!cat %%c%%U').
  2. Copies all files into register specified via command argument ("%aya in :normal).
  3. Leaves custom view (h in :normal).
by

Thanks.

  1. "%aya — why two “a”s?
  2. %rx for echo made the list space-separated. Maybe it is easier to use vifminfo?
by

"%aya — why two “a”s?

%a is replaced with register name.
ya -- yank all files.

So :readreg y produces "yya.

%rx for echo made the list space-separated. Maybe it is easier to use vifminfo?

I output list with :!for i in %rx; do echo "$i"; done > file. vifminfo can change, so better not to use it for such purposes.

...