Open Redbeard93 opened 1 year ago
Thanks. I've installed & set the previewer to chafa
. Works fine for images. But I wanted the preview to also still work with text files, and show the file metadata too.
I ended up creating the below scripts (based on this). Here's the Gist.
CustomPreviewer.cmd
--> lf should set the previewer to this file. Runs CustomPreviewer.ps1
.CustomPreviewer.ps1
--> Contains the actual previewing code, which uses chafa
for images. Handles text files & displays file metadata too.Install chafa:
winget install hpjansson.Chafa --scope machine
Get the above script files and put them anywhere in your system.
Open your lfrc
file and add the below line:
# Custom file previewer
set previewer "<PathToScriptsFolder>\\CustomPreviewer.cmd"
E.g:
set previewer "C:\\ProgramData\\lf\\CustomPreviewer.cmd"
Restart your terminal(s).
Here's the output:
As an alternative, one can also use the browser to preview files.
On linux we use external packages like ueberzug that use imagemagick to display the image in the terminal. Imagemagick work on powershell but I don't think an equivalent of ueberzug actually exist for PS. If someone knows one I'm interested too.