Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rempas opened this issue Apr 2, 2020 · 11 comments
Closed

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

rempas opened this issue Apr 2, 2020 · 11 comments
Labels

Comments

@rempas
Copy link

rempas commented Apr 2, 2020

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
Copy link
Contributor

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
Copy link
Author

rempas commented Apr 2, 2020

Sure! Can I get a link?

@Provessor
Copy link
Contributor

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

The changes are:

  • previewer is now run with (previewer) [path] [height] [width] [x] [y] [ID], x and y are the cell coordinates for the top left corner of the previewer pane
  • New option cleaner which is run before generating a new preview (both file and directory) -- (cleaner) [ID]

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
Copy link
Author

rempas commented Apr 3, 2020

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

@Provessor
Copy link
Contributor

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
Copy link

Monirzadeh commented Apr 8, 2020

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
Copy link

f8ith commented Apr 9, 2020

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

@Monirzadeh
Copy link

Monirzadeh commented Apr 9, 2020

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
Copy link
Contributor

@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
Copy link

Monirzadeh commented Apr 10, 2020

@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
Copy link
Contributor

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.

@rempas rempas closed this as completed Apr 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants