Skip to content

misaelabanto/imgview.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

imgview.nvim

Open image files in Neovim as actual images instead of binary garbage. Renders through the kitty graphics protocol, so it works in Ghostty, kitty, and any terminal that implements the protocol.

When you :edit photo.jpg you get a single header line (photo.jpg 1920x1080) and the image drawn in the window, scaled to fit and centered. No binary text, no modified buffer, no swap file.

Requirements

  • Neovim 0.10+
  • A terminal with kitty graphics protocol support (Ghostty, kitty, WezTerm)
  • ImageMagick (magick or convert) for non-PNG formats. PNGs work without it.

Install

With lazy.nvim (NvChad uses it):

{
  "misaelabanto/imgview.nvim",
  lazy = false,
  opts = {},
}

Or from a local checkout:

{
  dir = "~/code/imgview.nvim",
  lazy = false,
  opts = {},
}

Configuration

Defaults shown:

require("imgview").setup({
  -- file extensions handled by the plugin (upper-case variants included)
  extensions = { "png", "jpg", "jpeg", "gif", "bmp", "webp", "ico", "avif", "tiff", "tif" },
  -- assumed terminal cell width/height ratio, used to fit images to the window
  cell_aspect = 0.5,
})

Notes

  • Animated formats (gif, webp) show their first frame.

  • Conversions are cached in stdpath("cache")/imgview, keyed by path and mtime.

  • tmux is supported: graphics sequences are wrapped in tmux's passthrough envelope automatically. You only need tmux 3.3+ with passthrough enabled in ~/.tmux.conf:

    set -g allow-passthrough on

    The plugin warns once per session if it detects tmux without it. Known limitation of tmux passthrough: switching tmux windows/panes does not erase an already drawn image, so a stale image can linger until the next redraw (:e or resize re-renders, leaving the buffer clears it).

Tests

nvim --headless --clean -l tests/run.lua

About

Open images in Neovim via the kitty graphics protocol (Ghostty, kitty, WezTerm), with tmux passthrough support

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages