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.

Read a register from a file

0 votes
asked Feb 13, 2016 in vifm by aleksejrs

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

1 Answer

+1 vote
answered Feb 13, 2016 by xaizek

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).
commented Feb 14, 2016 by aleksejrs

Thanks.

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

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

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here won't be considered as spam, but this is not a perfect place for it.
...