I installed the lf file manager on macOS and configured it for my purposes but I can't configure it for image preview.
I tried it using ueberzugpp but it needs to add lfrun file to /usr/bin. It's not possible because it wants to remove system integrity protection.
I tried the w3mimgdisplay method described in lf github wiki. It also failed, but I can use imgcat to show images in iterm2.
Can I implement it to show images in lf file manager?
The ranger wiki page has iterm2 integration directly for image preview. It works in my ranger. But I want to use lf because I can run shell script in it easily.
Start by configuring
lfpreview as explained in the man page by creating a~/.config/lf/lfrcfile:and creating the
~/.config/lf/pv.shscript:Set the script as executable with:
lfpreview is now configured as in the man page. To add image preview, you can modify~/.config/lf/lfrcsuch as:and
~/.config/lf/pv.shsuch as:This will allow you to preview jpeg files by pressing i in
lf. You can easily add another image file formats in the preview script.The main difference with the example in documentation is that the pager (
less -R) is run directly in the preview script and only for text formats, as the pager cannot be run on images.