Use a change-oriented prefix followed by a short kebab-case description, for example feat/telescope-model-preview, fix/markdown-renderer-fallback, or docs/markdown-renderers. Accepted prefixes are feat/, fix/, docs/, chore/, refactor/, test/, ci/, perf/, and revert/. Run make setup-hooks to enable the local pre-push check. CI applies the same validation to pull requests from branches in this repository; pull requests from forks retain their contributor branch namespace.
- Neovim >= 0.10
- ImageMagick >= 7 (
magickCLI)
| Dependency | Usage |
|---|---|
| openssl | Certificate metadata extraction |
| ffmpeg | Video thumbnail extraction and inline animation |
| f3d | 3D model thumbnails and turntable frames |
| plantuml + Java | PlantUML diagram rendering |
| mmdc (mermaid-cli) | Mermaid diagram rendering |
| leaf / glow / mdcat / pandoc | Markdown rendering (first found wins) |
| ghostscript | PDF rendering via ImageMagick |
| tmux >= 3.4 | Escape sequence passthrough (Kitty Graphics via tmux) |
kitten |
Included with Kitty |
wezterm CLI |
External pane in WezTerm |
imgcat |
Included with iTerm2 shell integration |
Install at least one Markdown renderer for local preview testing. The default configuration tries renderers in this order: leaf, glow, mdcat, pandoc, then cat.
# macOS (Homebrew): choose one
brew install leaf-markdown-viewer
# brew install glow
# brew install mdcat
# brew install pandocFor Linux, the official installer commands include curl .../leaf/main/scripts/install.sh | sh for leaf, go install github.com/charmbracelet/glow/v2@latest for glow, cargo install mdcat for mdcat, and sudo apt install pandoc for Debian or Ubuntu. See the upstream installation guides for leaf, glow, mdcat, and pandoc when using another platform.
# Required for Kitty Graphics via tmux
set -gq allow-passthrough on
set -g visual-activity off
# Propagate environment variables to new sessions
set -ga update-environment WEZTERM_UNIX_SOCKETlua/glimpse/
βββ init.lua -- Public API: setup(), show(), preview(), close(), helpers
βββ detect.lua -- Terminal detection via tmux client_termname
βββ kitty.lua -- Kitty Graphics Protocol (transmit, delete, prefetch)
βββ renderer.lua -- Placement management and extmarks
βββ sixel.lua -- Sixel protocol (fallback)
βββ thumbnail.lua -- Video thumbnail extraction (ffmpeg, async)
βββ magickwand.lua -- ImageMagick interface for conversion
βββ pipeline.lua -- Steps-based conversion pipeline (run_steps, run_sequence)
βββ pipeline_previewer.lua -- Shared runtime for pipeline-based previewers (tokens, animation, cleanup).
β -- renderer.auto_play=false starts paused; h/l seek frames, <CR> toggles play.
βββ auto_refresh.lua -- BufWritePost hook: re-renders active previews on save (opt-in via auto_refresh)
βββ util.lua -- Format detection (image, video, model, diagram, markdown...)
βββ archive.lua -- Archive listing and suspicious path detection
βββ font.lua -- Font metadata extraction and rendering
βββ sqlite.lua -- SQLite schema preview
βββ safety.lua -- File validation and safety checks
βββ frames/
β βββ init.lua -- Router: selects strategy from config (auto/batch/poll/pipe)
β βββ auto.lua -- Selects pipe when ffmpeg is available
β βββ batch.lua -- Low-res preview immediately, full-res all at once when done
β βββ poll.lua -- Progressive delivery as ffmpeg writes files to temp dir
β βββ pipe.lua -- Binary-safe streaming via image2pipe + temp file polling (default)
βββ previewer/
β βββ archive.lua -- Archive previewer
β βββ cert.lua -- X.509 certificate previewer
β βββ binary.lua -- Binary previewer (file + hexdump)
β βββ font.lua -- Font previewer
β βββ image.lua -- Inline image previewer
β βββ key.lua -- GPG/SSH key previewer
β βββ markdown.lua -- Markdown previewer (leaf/glow/mdcat/pandoc, terminal buffer)
β βββ mermaid.lua -- Mermaid diagram previewer (mmdc)
β βββ model.lua -- 3D model previewer via conversion pipeline (f3d)
β βββ plantuml.lua -- PlantUML diagram previewer (plantuml -pipe)
β βββ sqlite.lua -- SQLite previewer
β βββ video.lua -- Inline animation (Kitty/Ghostty) or thumbnail fallback
βββ strategy/
β βββ inline.lua -- Inline rendering + autocmds
β βββ pane.lua -- External pane rendering (WezTerm, iTerm2)
βββ integrations/
βββ oil.lua -- Oil.nvim integration (preview, open, prefetch)
βββ neotree.lua -- Neo-tree integration (auto-preview, cleanup)
βββ telescope.lua -- Telescope integration (scoped picker preview)- Transmission via
t=f(file path) - terminal reads from disk - Unicode placeholders (
U=1) - character U+10EEEE with diacritics for row/col - Image ID encoded in foreground color of highlight (
nvim_set_hl) - Inside tmux: escape sequences wrapped in
\ePtmux;...\e\\
- Conversion via
magick ... sixel:- - Displayed in tmux pane (not inline)
- Comments in English
- Public functions in camelCase
- Private functions with
_prefix orlocal - Type annotations via
@param,@return,@class - Formatting via StyLua (
.stylua.toml) - Linting via luacheck (
.luacheckrc)
stylua lua/ tests/luacheck lua/ tests/make testRequires plenary.nvim and ffmpeg installed.
make bench" Test terminal detection
:lua print(require('glimpse.detect').get_terminal())
" Test image rendering
:lua require('glimpse').show('/path/to/image.png')
" Test video preview (inline animation on Kitty/Ghostty, thumbnail otherwise)
:lua require('glimpse').preview('/path/to/video.mp4')
" Test inline animation directly
:lua require('glimpse.previewer.video').show('/path/to/video.mp4')
" Test prefetch
:lua require('glimpse.kitty').prefetch('/path/to/image.png', { width = 40, height = 30 })
" Test WezTerm socket
:lua print(require('glimpse.strategy.pane')._find_wezterm_socket())- First load latency:
magicktakes ~700ms-2s for large images. Cache resolves subsequent accesses. - Terminal latency: after transmission, the terminal takes ~200-500ms to render. Outside our control.
- WezTerm: does not support unicode placeholders - uses external pane via
wezterm cli. - WezTerm + tmux: requires
WEZTERM_UNIX_SOCKETpropagated viaupdate-environment. - Video thumbnails: first extraction takes ~500ms. Subsequent previews use cache.
- Inline animation: requires Kitty or Ghostty. WezTerm, iTerm2, and tmux+Sixel fall back to a static thumbnail.
- Inline animation + resize: re-extracts all frames when the preview window is resized; expect a brief blank before the new animation starts.