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.

More or less complex commands or functions in vifmrc?

0 votes
asked Nov 10 in vifm by John Huffam

As I see, in vifm, we can't have functions in a config file in order to call those later with custom commands or mappings, as we can do with Vim, is that right?

And if I want to introduce a command, which is a bit more complex than a few pipes, I have no choice but to put that into a custom shell script, and then to place that script somewhere in the $PATH, right?

1 Answer

0 votes
answered Nov 10 by xaizek

As I see, in vifm, we can't have functions in a config file in order to call those later with custom commands or mappings, as we can do with Vim, is that right?

Correct. There are no functions at the moment. And I'm somewhat hesitant to add them as people might start doing crazy things in a not so well defined language.

Someone proposed using Lua for the language. I didn't like the idea at the time, but maybe it would really be better to add it with an API to call vifm's functions and get lots of things for free. This would sort of keep complicated stuff away from builtin language.

And if I want to introduce a command, which is a bit more complex than a few pipes, I have no choice but to put that into a custom shell script

If it's essentially a shell script, then yes and functions wouldn't be of much help. It would still have to be a single (possibly multiline) invocation of :! command.

and then to place that script somewhere in the $PATH, right?

Do :cd $VIFM/scripts inside vifm and put vifm-specific scripts there to not have them in $PATH outside vifm.

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