Skip to content

feat: add viewport overlay for float mode#289

Open
zlj-zz wants to merge 1 commit into
Isrothy:mainfrom
zlj-zz:feature/viewport_overlay
Open

feat: add viewport overlay for float mode#289
zlj-zz wants to merge 1 commit into
Isrothy:mainfrom
zlj-zz:feature/viewport_overlay

Conversation

@zlj-zz
Copy link
Copy Markdown

@zlj-zz zlj-zz commented May 15, 2026

Summary

This PR adds a viewport overlay feature that highlights the currently visible source range on the minimap in float layout mode.

When enabled, the minimap dims (or highlights, depending on the user's highlight group) the lines that correspond to the source window's current viewport. This gives users immediate visual feedback about where they are in the file.

Why matchadd instead of extmarks

Multiple source windows can share the same minimap buffer (one minimap buffer per source buffer). extmarks are buffer-scoped, so a per-window overlay cannot be cleanly expressed with namespaces.

vim.fn.matchadd with { window = mwinid } is window-scoped, so each minimap window can have its own independent viewport highlight even when the underlying buffer is shared.

Configuration

viewport = {
    -- Highlight the visible source range on the minimap.
    -- Only supported when layout == "float".
    enabled = false,
    priority = 5,
    hl_group = "NeominimapViewport",
}

Default is enabled = false to avoid breaking existing users.

Highlight group

NeominimapViewport — links to Visual by default.

Limitation: float mode only

Split mode is intentionally not supported. The split layout uses a single shared minimap window per tab and does not implement autoscroll (the minimap does not track the source window's scroll position). A viewport overlay in this context would often highlight a region outside the minimap's visible area, providing little useful feedback.

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.

1 participant