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.

Function to show if :view is enabled or not

0 votes
asked Mar 23 in vifm by anonymous

I'm looking for a function to check wether

:view
is set or not.

Couldn't find a function or &option to check this.

Background: Want to toggle view with a new key mapping similar to this question on stackoverflow, but want to have resize panes back to same size if (file-pre)view is disabled.

1 Answer

0 votes
answered Mar 23 by xaizek
edited Mar 30 by xaizek

I checked the sources (in case I forgot something) and looks like results of your search are correct, state of preview isn't exposed anywhere. Will add it as an option ('quickview').

At the moment I can think of a horrific workaround which involves saving vifminfo to get state of the preview, but I'm not sure you'll want to use it.

Somewhat different way might be to set a $VARIABLE whenever you call :view and check it later (how well it will work depends on operations you perform).

commented Mar 23 by durcheinandr

An option for checking the view-state will be the best. Thanks

Writing vifminfo with :write; checking $MYVIFMRC for q1 in the TUI-Section; changing pane-size with <c-w>| or <c-w>= depending on result followed by :view... I will try this as workaround.

Setting a $VARIABLE involves also checking $MYVIFMRC (at least at startup) , so the former workaround will do it until the option is added.

Thanks for fast help and thanks for vifm

commented Mar 30 by durcheinandr

Thanks for adding the quickview option this fast

commented Jul 14 by anonymous

Is this option available in 0.9.1?

commented Jul 14 by xaizek

No, 0.9.1 was released earlier than it was added.

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