Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

hi,

I'm testing Lua integration in Vifm through a practical example to be shared later.

The goal is to display the result of a script that gives me the first six characters of the md5sum of the file currently under the cursor in the statusline.

The Lua script has been fully tested and is integration-ready

What is the best way to pass a file argument to the Lua script and fetch its output for display in the statusline?

thanks for your advice and your time

1 Answer

0 votes
by

Hi,

If you want to use the script standalone, then it can be done via a macro like %{ system(expand('path/to/script %c') } in 'statusline'.

If you want to use it as a plugin, then take a look at an example. In this case a Lua handler should return the value for 'statusline' option in which you can insert anything custom, just don't forget to escape % signs like on line 17 in the example.

by

Excellent—I’ll test this in the following days and let you know how it goes. Thank you!

by

the script md5sum_of_file.lua is available under:

https://gitlab.com/Scripts_CaptainFantastic/VIFM_SCRIPTS/-/blob/main/md5sum_of_file.lua

Have fun

by

new project updated with hash xxh32sum on xaizek's suggestion for better efficiency:

https://gitlab.com/Scripts_CaptainFantastic/hash_of_file
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.
...