Skip to content
dobladezPublic

About

Images, PDF, docx, xlsx, ..., in the terminal, through the kitty graphics protocol

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Repository files navigation

clview

I hate leaving the terminal, so clv shows PDFs, images, Word documents, spreadsheets, drawings, Markdown and HTML inside it.

clv_demo.mp4

🤖 DISCLAIMER: entirely coded using Claude Code, and a bit of Codex (from my kitty terminal, of course)

clv draws using the kitty graphics protocol when available: kitty, Ghostty and WezTerm, locally or over SSH, and inside tmux or Zellij too. It runs on macOS, Linux and FreeBSD. Other terminals get a preview in text cells.

clv report.pdf             # page through it, like less
clv --zoom 4 report.pdf    # four pages to a row
clv --no-pager report.pdf  # print every page and exit, like cat
clv photo.jpg              # an image, printed at the cursor
clv diagram.svg            # a drawing, as large as the window and sharp at that size
clv letter.docx            # a Word document's pages, laid out as Word prints them (odt, rtf too)
clv notes.md               # Markdown, laid out into pages (HTML too)
clv budget.xlsx            # a workbook's sheets, printed as its app prints them (xls, ods, csv too)
clv *.pdf                  # several files: a tile each, Enter opens one
clv ~/Photos               # a directory: its files, and its subdirectories as folders
clv -r ~/Photos            # its subdirectories' files too, as tiles of their own
clv comics.zip             # an archive: its files and directories, as a directory's
clv photos.tar.xz          # a tar too, plain or compressed, read through once with progress
clv paper.pdf.gz           # a file compressed alone: the PDF it unpacks to
clv --protocol ascii photo.jpg > photo.txt  # as plain text, for a log or a mail

A file with more than one page opens in a pager. The pager shows one page, or two pages side by side when the window is wide enough. Use - to zoom out to rows of pages. Use + to zoom in. Use ? to show the keys.

Two or more files, a directory or an archive open as a list of tiles. A file's tile shows its first page and its name. Use the arrow keys to select a tile. Use Enter to open it. A file opens to its pages, and a folder opens to its own list. Use Esc or u (up) to go back.

Use c to copy the current page or tile to the clipboard as a picture.

Markdown and HTML go light on dark on a dark terminal. Use d to switch them between dark and light.

See docs/usage.md for all options and more details.

What it shows

clv --help lists the formats your build shows and the options of those that take some.

Shows Through
PDFs pdfcraft
PNG, JPEG, GIF, WebP, TIFF, BMP, ICO, QOI, JPEG XL, OpenEXR, HDR, TGA and more the image crate, and JPEG XL jxl-oxide
SVG drawings and svgz resvg
Word documents (docx, doc), OpenDocument text (odt) and RTF wordcraft's readers, layout and renderer, with fonts of its own under the SIL Open Font License
Markdown and HTML, with the pictures they refer to on disk wordcraft again, and pulldown-cmark for Markdown
Spreadsheets (xlsx, xlsm, xlsb, xls, ods, csv, tsv) gridcraft's engine, which prints a workbook to a PDF that clv then shows
Zip archives (and what is a zip inside: jar, cbz, epub…), as directories the zip crate
Tar archives, plain or compressed with gzip, bzip2 or xz (tgz, cbt…), as directories; and a file compressed alone (paper.pdf.gz) flate2, the bzip2 crate and lzma-rust2, and a tar reader of clv's own

Installing

Binaries for macOS and Linux are on the releases page: unpack one and put clv on your PATH. They aren't signed, so on macOS one downloaded by a browser wants xattr -d com.apple.quarantine clv before it runs. Or build it, with Rust 1.95 or later:

cargo install --locked --git https://github.com/dobladez/clview    # installs `clv`

Plans

  • Let go of a list's files once the reader has moved on: a PDF opened holds its whole file until the list is left.
  • More than one PDF backend to choose from.
  • AVIF, colour profiles, and an animation's frames as its pages.
  • More archives: zstd, 7z; a comic book archive (cbz) as a book, its pictures its pages; an epub's pictures, and a document's in an archive.
  • Sixel, which would bring Windows Terminal and the terminals that speak only sixel.

Working on clview

How to build and test it, and the rules its code keeps, are in CONTRIBUTING.md. How it works inside is in docs/architecture.md, and why some choices were made in docs/adr/.

Short History

clv began as the view subcommand in pdfcraft's command line, in pull request #2920. I immediately realized I wanted to support all other types of docs and it had to be a separate tool.

License

MIT or Apache-2.0, at your option.

About

Images, PDF, docx, xlsx, ..., in the terminal, through the kitty graphics protocol

Resources

Contributing

Stars

14 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages