Skip to content

Kitty-graphics minimaps for overview strips (feedback wanted) - #13

Closed
CoreyKaylor wants to merge 2 commits into
mainfrom
minimap-kitty
Closed

CoreyKaylor wants to merge 2 commits into
mainfrom
minimap-kitty

Conversation

@CoreyKaylor

Copy link
Copy Markdown
Owner

Closes #10. This adds pixel-resolution minimaps beside each diff pane, plus an opt-in minimap for ordinary editor windows. It's opened early to gather feedback: please try it and comment, especially on the questions at the bottom.

What it does

Diff view overview strips

  • In terminals with Kitty graphics and Unicode placeholders (Ghostty, Kitty, …) each strip is an image. Every other terminal (tmux, iTerm2, Terminal.app) keeps the existing one-column cell gutter.
  • The code shape (default on): the file drawn as tiny syntax-coloured runs, so you can see where you are by the shape of the code. Colours come from treesitter captures, falling back to legacy syntax and then Normal.
  • Hunk marks are drawn at pixel resolution and the current chunk is outlined.
  • Overlays:
    • the viewport band (always visible);
    • 'hlsearch' matches;
    • the visual selection;
    • diagnostics.
  • Scale: fills the window height, with a min_reduction floor so short files aren't stretched.
  • Mouse: click or drag to jump; the wheel scrolls the pane. No mappings are added to your buffers.
  • Focus-follow: the focused pane's strip is full width (12 cells), the other a squeezed 4-cell version of the same shape. They swap when focus moves, and the panes keep equal widths.
  • Cost: the image is re-sent only when hunks, size or palette change. Scrolling and cursor moves only swap highlights.

Editor windows: :DiffBanditMinimap [toggle|open|close], or minimap.auto = true

  • A float on the window's right edge showing git hunks against the index, diagnostics, search, selection and the viewport.
  • Hidden on narrow windows. Skips help, quickfix and the like, and DiffBandit's own tabs.

Config

require("diffbandit").setup({
  ui = {
    overview = {
      renderer = "auto",   -- "cells" to opt out of images
      code_shape = true,
      code_width = 12,
      focus_follow = true,
      compact_width = 4,
      min_reduction = nil, -- auto
      -- viewport / search / selection / mouse toggles
    },
  },
  minimap = {
    auto = false,          -- editor-window minimaps
    git = true,
    diagnostics = { enabled = true, min_severity = "warn" },
    min_window_width = 60,
  },
})

Internals

  • minimap/ is a shared Minimap component (target window + provider + placement). The diff view's strips are managed minimaps in the layout's sidecar splits; editor minimaps are floats.
  • The diff view's minimaps borrow the session's renderer, so strip width and paint always agree after a probe or a fallback.
  • The old session/overview.lua is gone.
  • Tests: tests/specs/45_kitty.lua (raster, images, overlays, code shape, mouse, focus-follow) and the new tests/specs/55_minimap.lua (editor minimap). The full suite passes.

Feedback wanted

  1. Code shape on by default: is it useful, or noisy? Is 12 cells the right default width?
  2. Focus-follow: does the wide/compact swap feel natural, or is the pane shift on focus distracting? Should compact_width be smaller or larger?
  3. Editor minimap: would you use it? Is a float on the right edge the right placement, or would you prefer a split?
  4. Overlays: are search, selection and diagnostics all worth showing, or is it too busy?
  5. Terminals: any rendering problems in your terminal (colour, blur, misplaced placeholders)? Please mention the terminal and font size.
  6. Merge view: this PR leaves the merge view as it was. Do you want minimaps there too?

Closes #10. The overview strip beside each pane becomes a pixel-resolution
image in terminals with Kitty graphics and Unicode placeholders; other
terminals keep the cell gutter.

- kitty/overview + kitty/overview_raster: one image per strip, placeholders
  written straight into the static overview buffer. Per-hunk marks at pixel
  resolution, the current chunk outlined. Viewport band, cursor row and
  selection are per-row highlight groups that keep the image id as fg, so
  scrolling only swaps highlights; the image is re-sent only when hunks,
  size or palette change.
- Code shape (default on): the text drawn as tiny syntax-coloured runs
  (treesitter captures, legacy syntax, Normal fg), rebuilt after
  code_debounce_ms on edits.
- Overlays: viewport always visible, 'hlsearch' matches, visual selection,
  diagnostics. Scale fills the window with a min_reduction floor.
- Mouse without maps in user buffers: click and drag jump, the wheel
  scrolls the target.
- minimap/: a shared Minimap component (target + provider + placement).
  The diff view's strips are managed minimaps; :DiffBanditMinimap (and
  minimap.auto) puts one on ordinary editor windows as a right-edge float
  showing git hunks against the index and diagnostics.
- Focus-follow: the focused pane's strip is full width, the other a
  squeezed 4-cell code shape; sizes swap on focus (after a mouse release),
  panes keep equal widths.
@CoreyKaylor

Copy link
Copy Markdown
Owner Author

Closing in favor of extracting the capability into its own plugin.
https://github.com/CoreyKaylor/purrview.nvim

@CoreyKaylor CoreyKaylor closed this Nov 4, 2026
@CoreyKaylor
CoreyKaylor deleted the minimap-kitty branch November 4, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pixel-resolution overview minimap using Kitty graphics

1 participant