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

Is there a way to show what is yanked on the statusbar? For example, if it is a text, or some files.

Thank you

1 Answer

+1 vote
by
selected by
 
Best answer

You can only yank files in Vifm. If you're interested in system's clipboard, then use the %{<expr>} macro.

by

For the yanked files, can any information about them be displayed on statusbar?

by

You can expand %r" inside %{} using expand() function, but more complex processing will need running an external command.

by

I put together this:

set statusline+=" files copied: %{extcached('yanked',
                                        \ expand('%r'),
                                        \ expand('bash mYank.sh %r'))} "

My objective is to show the number of yanked files in statusbar. So, I wrote a script to count the number of inputs (%r). I am also using %r to invalidated the cache when the yanked files are changed. It shows the full path to all yanked files on statusbar. It also executes the script ever time cursor moves.

Can it be changed so that it does not print yanked items on statusbar, and also only triggers the script when the yanked items are changed?

by

You didn't specify register name after %r. This works for me:

set statusline+=" files copied: %{extcached('yanked',
                                          \ expand('%r\"'),
                                          \ expand('printf \"%%s\\\\n\" %r\" | wc -l'))} "
by

This works great. Thank you.
Could you explain the \"%%s\\\\n\" part?

by

printf prints all arguments except the first one using the format specified in the first. %s\n makes it print each of them on a new line.

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