Skip to main content
Previewer plugins generate visual previews of files in Yazi’s preview pane. They can display text, images, videos, archives, and any custom format.

What Are Previewers?

Previewers show file contents in the right pane of Yazi. Built-in previewers handle:
  • Code files with syntax highlighting
  • Images (PNG, JPEG, WebP, etc.)
  • Videos (thumbnails/frames)
  • Archives (file listings)
  • PDFs (rendered pages)
  • Folders (directory listings)

Previewer Structure

Previewers implement these methods:

The Job Object

Example: Image Previewer

Here’s Yazi’s built-in image previewer:
Configure in yazi.toml:

Example: Code Previewer

Display code files with syntax highlighting:

Example: Video Previewer

Extract video frames as previews:

Example: PDF Previewer

Render PDF pages as images:

Example: Archive Previewer

List contents of archive files:

Preview Widgets

Display Text

Display Images

Display List

Display Error

Caching

Use ya.file_cache() to get cache paths:

Scrolling

Handle scroll with seek():

Upper Bounds

Tell Yazi the maximum scroll position:

Best Practices

Even if scrolling isn’t supported:
Generate previews in background:
Check if external tools exist:
Check configuration:

Next Steps

Fetchers

Create metadata fetchers

UI Plugins

Customize the interface