gokcehan / lf

Terminal file manager
MIT License
7.71k stars 329 forks source link

[QUESTION] Is there a way to have image/video previous? #316

Closed rempas closed 4 years ago

rempas commented 4 years ago

I know that their is no build in to do this but is there something like a plugin or a way to do it?

Provessor commented 4 years ago

I am currently working on a pull request to improve previewing scripts for this (#304), it's not finished yet but if you're interested in possibly testing it, that would be very much appreciated.

rempas commented 4 years ago

Sure! Can I get a link?

Provessor commented 4 years ago

The repo is at https://github.com/Provessor/lf/tree/imgpv, these are the scripts I'm using with it.

The changes are:

I have a list of tasks still to be done in the PR (direct) to improve this, however, all of the functionality should be working.

Building: go build (optional: go install) Dependencies: go compiler, method of generating previews (kitty, ueberzug, sixel, etc.)

Let me know if you have any problems or questions!

rempas commented 4 years ago

You know, the thing is that I don't even know the main script. What should I do after I compile lf?

Provessor commented 4 years ago

If you installed with go install then make sure ~/go/bin is in $PATH (I'm not sure what the directory is for Windows).

The doc goes over all of the configuration settings (unix: $HOME/.config/lf/lfrc, windows: C:\Users\<user>\AppData\Local\lf\lfrc), IMO the defaults are sane and don't need many changes.

For previews you would just want something like (using my sample scripts, lf would need to be started with startlf):

set preview true
set previewer ~/.config/lf/pistol
set cleaner ~/.config/lf/cleaner

The set previewer and set cleaner are generally scripts run with the arguments I said before (note: [ID] is the internal ID of the current lf instance)

I also use something like:

set drawbox true        # Draw a box around panes
set icons true          # Icons in list (https://github.com/gokcehan/lf/wiki/Icons)
set ignorecase true     # Ignore case when searching

map gh cd ~
map gmu cd ~/Music
map gme cd /media
...
Monirzadeh commented 4 years ago

Hi @Provessor i clone and build your repository on my system with this command

git clone https://github.com/Provessor/lf.git
cd lf
go build

next i add this line to my lfrc

set preview true
set previewer ~/.config/lf/previewer
set cleaner ~/.config/lf/cleaner

create this files cleanerand previewer in ~/.config/lf/ and startlf in repository location. make all of them executable when i set preview! noting show to me (uberzug work fine with ranger on my system) i get this error too unknown option: cleaner did i miss something?

f8ith commented 4 years ago

You may have to uninstall lf and add $GOPATH to your path

Monirzadeh commented 4 years ago

i remove lf from my /usr/local/bin/ and my $GOPATH set correctly but still not working Update: my editor show me bellow error for line 7-8 previewer and 3-4 cleaner

[bash] [W] Syntax error: expected " ...
Provessor commented 4 years ago

@Monirzadeh the changed are under the imgpv branch in my repo so your build instructions would need to be

git clone --branch imgpv https://github.com/Provessor/lf.git
cd lf
go build

Or just run this in your current clone

git checkout imgpv 
go build

Also with those scripts if lf is not started with startlf (or an alias to that), there will also be no image previews. This might change in the future and I'll keep you updated if it does.

Monirzadeh commented 4 years ago

@Monirzadeh the changed are under the imgpv branch in my repo so your build instructions would need to be

git clone --branch imgpv https://github.com/Provessor/lf.git
cd lf
go build

Or just run this in your current clone

git checkout imgpv 
go build

Also with those scripts if lf is not started with startlf (or an alias to that), there will also be no image previews. This might change in the future and I'll keep you updated if it does.

thank this work but i think ,it need some improvement. where should I report them? here or somewhere else?

Provessor commented 4 years ago

I've got PR #304 to track my progress, this would be the best place to report any issues or suggest improvements.

My only request is that you check against the most recent commit and make sure its not already in the TODO list before reporting any problems.