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

Hi,

Is there a config option to enable vifm to always run with --choose-dir - ?

Thanks :)

1 Answer

0 votes
by

Hi,

No, there isn't. What would be the use case?

Usually you need special handling of redirected output when this option is passed in, otherwise the output won't be consumed because it would just be printed on the terminal. And in cases of invocations with redirection passing --choose-dir - is basically that configuration option.

by
edited by

(sorry for duplicate comment, must have an issue)

Yes I wish we could make it the default behavior.

I don't mind my latest directory getting printed to console, and I often use vifm in commands so it's a bit verbose to write that option every time...

Maybe it is possible to have some keybinding exiting vifm with current path as return value ?

Something like nnoremap Zp :!echo %c:p<CR>:exit<CR> but that does not work (correctly prints to console but not usable as command argument substitution)

by

Yes, :!echo prints to the current output stream, which is always a terminal, rather than the original stream.

An option can be added, original stream is always preserved, just not used without --choose-dir - or alike. A more flexible way is probably to expose the stream to Lua which already has "on exit" event and could print various things there.

By the way, have you tried defining a shell alias for vifm that includes --choose-dir -? That might also address this.

by

Yes I tried alias but it's not exactly ideal.

How can I echo to the original stream ? / expose stream to Lua ?

I actually really like this idea of Key shortcuts to achieve the original goal.

by

Sorry, must have missed your last comment.

How can I echo to the original stream ? / expose stream to Lua ?

That needs to be changed in Vifm's code.

by
edited by

Added vifm.stdout() function to Lua API, so it's now possible to print to output stream (unless it's a terminal) as vifm.stdout():write('something').

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