lf
lf copied to clipboard
A Single Pane for NoPreview
By default, lf
's nopreview
look like you are on the parent directory but controlling the child directory. I would love lf
to have similar nopreview
to ranger
's.
First is ranger
, second is lf
with set preview
, and third is lf
with set nopreview
. you can't tell the last two apart easily. nopreview
should make it easier to read long files/dirs names. the grandparent is unnecessary.
in other words, set nopreview
should remove last ratio
.
in other words,
set nopreview
should remove lastratio
.
You can adjust ratio with ratios
option (string, default to '1:2:3'
).
I know. It would be sensible to remove the last ratio
if you remove the preview pane.
I know. It would be sensible to remove the last
ratio
if you remove the preview pane.
You can always create your own cmd
for that.
Here is an example for you:
cmd nopreview &{{
lf -remote "send $id set nopreview"
lf -remote "send $id set ratios 1:3" # or whatever
}}
Just type :nopreview
in a lf instance (make sure that instance has read the new configs) and press Enter.
I still think set nopreview
should purge the preview pane by default. @gokcehan can feel free to close the issue if he doesn't consider this behavior more intuitive and universal.
I still think
set nopreview
should purge the preview pane by default. @gokcehan can feel free to close the issue if he doesn't consider this behavior more intuitive and universal.
I bet he doesn't because the design decision he made (at least I'm thinking he made), he wants everything to be individual and user extensible as in the UNIX tools' combination harmony.
Also, nopreview
means "nopreview" for the file content, not changing the ratio.
UNIX philosophy and streams are not at odds with sensible defaults at all; almost all users having to tweak a core function calls for stronger defaults, IMO. nopreview
removing the pane is debatable as I see construction behind it, even if it still feels unintuitive.
Sometimes there are no sensible defaults no matter what. If we change it the other way around, I'm sure there will be people asking why the last value of ratios
is ignored. Maybe in this case an alternative would be to somehow combine ratios
and preview
options into a single option but I can't think of a good way to do that. I thought about adding a special character to ratios
option (e.g. 1:2:*3
denotes that the last 3
is a preview pane and the lack of *
would imply no previewing) but I think most people would rather expect a preview
option in this case. We also still lack an option to toggle info in different panes so ideally it should also be combined into the same option (e.g. -1:2:*3
denotes that info should not be shown in the first pane but only in second and third panes).
I also prefer rangers behaviour here, I find it less confusing and it makes it easier to see longer file names.
That said, I'd like to bind a command which toggles the display of the preview. Using @roket1428 solution:
cmd nopreview &{{
lf -remote "send $id set nopreview"
lf -remote "send $id set ratios 1:3" # or whatever
}}
only goes one way. @gokcehan is there a way to inspect the current value of ratios
from within a command so that you can toggle between two states?
@mohkale There is no way to inspect the value of options for now, but I think I have seen some people using map
to implement toggling in one of the issues around.
Wow, that's amazing, thanks gokcehan.
cmd showpreview &{{
lf -remote "send $id set preview"
lf -remote "send $id set ratios 1:2:3"
lf -remote "send $id map zp nopreview"
}}
cmd nopreview &{{
lf -remote "send $id set nopreview"
lf -remote "send $id set ratios 1:3"
lf -remote "send $id map zp showpreview"
}}
map zp nopreview
I'd still prefer a way to inspect the current value of the option so I don't have to hardcode my bindings, but this is still pretty cool :sunglasses:.
@mohkale I don't think we have an open issue regarding option values. Feel free to open a separate issue for it. I don't have much time to spare on lf these days, but someone else can get interested in working on it.
This is my current setup after the PR for accessing options was merged:
map ~ ${{
if [ $lf_preview == true ]; then
lf -remote "send $id set nopreview"
lf -remote "send $id set ratios 1"
lf -remote "send $id set info size:time"
else
lf -remote "send $id set ratios 1:2:3"
lf -remote "send $id set info"
lf -remote "send $id set preview"
fi
}}
Also here's something I came up with that lets you easily get the values for options. I should probably add this to the wiki because I bet I'm not the only one that wants to do it. Note that the way I wrote this requires set shell bash
, but I'm sure you could wrap it in an bash -c
to make it work with the default sh
shell.
# get config value
cmd get ${{
option="lf_${1}"
value="${!option}"
lf -remote "send $id echo $value"
}}
Usage: :get ratios
, :get preview
, get shell
, etc.