Giter Site home page Giter Site logo

stanleykozak / ctpv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nikitaivanovv/ctpv

0.0 0.0 0.0 2.23 MB

Image previews for lf file manager

Home Page: https://www.nikitaivanov.com/man1/ctpv

License: MIT License

Shell 7.21% C 86.08% Awk 3.37% Makefile 2.62% sed 0.72%

ctpv's Introduction

ctpv

File previewer for a terminal

showcase


ctpv is a file previewer utility for a terminal.

It was made with integration into lf file manager in mind, but I believe that it can be easily integrated into other programs as well.

It supports previews for source code, archives, PDF files, images, videos, etc. See Previews for more info.

Image previews are powered by one of these programs:

ctpv is a remake of an awesome program named stpv. stpv did everything I wanted, except it was a bit sluggish because it was written in POSIX shell. ctpv is written in C and is an attempt to make a faster version of stpv with a few new features.

Previews

Previewing each file type requires specific programs installed on a system. If a program is not found on the system, ctpv will try to use another one. Only one program is required for each file type. For example, you only need either elinks, lynx or w3m installed on your system to view HTML files.

File types Programs
any exiftool cat
archive atool
audio ffmpegthumbnailer ffmpeg
diff colordiff delta diff-so-fancy
directory ls
font fontimage
gpg-encrypted gpg
html elinks lynx w3m
image ueberzug chafa
json jq
markdown glow mdcat
office libreoffice
pdf pdftoppm
svg convert
text bat cat highlight source-highlight
torrent transmission-show
video ffmpegthumbnailer

Installation

Manual

If you are building from source, make sure to install these libraries! Depending on your system, you probably will also need "devel" versions of the same libraries.

  • libcrypto
  • libmagic

Install:

git clone https://github.com/NikitaIvanovV/ctpv
cd ctpv
make
sudo make install

Uninstall:

sudo make uninstall

AUR

If you are an Arch Linux user, you can install ctpv-git AUR package.

yay -S ctpv-git

MacPorts

With MacPorts, you can install the ctpv package.

sudo port install ctpv

Homebrew

With Homebrew, you can install the ctpv package.

brew install ctpv

Nix

Nix package

nix-env -ivf cptv
nix profile install nixpkgs#cptv # with flakes enabled

NixOS and HomeManager

If you don't need to call it directly and just want to use it through lf:

programs.lf = {
  previewer = {
    keybinding = "i";
    source = "${pkgs.ctpv}/bin/ctpv";
  };
  extraConfig = ''
    &${pkgs.ctpv}/bin/ctpv -s $id
    cmd on-quit %${pkgs.ctpv}/bin/ctpv -e $id
    set cleaner ${pkgs.ctpv}/bin/ctpvclear
  '';
}

Gentoo

Add this ctpv-9999.ebuild to your own repository.

Or alternatively:

eselect repository add sneethe-overlay git https://github.com/Sneethe/sneethe-overlay.git
emaint sync --repo sneethe-overlay
emerge --ask --verbose app-misc/ctpv

Integration

lf file manager

Add these lines to your lf config (usually located at ~/.config/lf/lfrc).

set previewer ctpv
set cleaner ctpvclear
&ctpv -s $id
&ctpvquit $id

Wayland

If you use Wayland, follow these steps:

As of 2023-03-19, original lf does not support sixel protocol, which is why you need use the fork.

Documentation

Full documentation on command line options, configuration and how to define custom previews can be found here: https://www.nikitaivanov.com/man1/ctpv

ctpv's People

Contributors

nikitaivanovv avatar suhailskhan avatar boscovn avatar sneethe avatar nechtarg avatar kalmander avatar harishnkr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.