feat: add viewport overlay for float mode#289
Open
zlj-zz wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
matchaddinstead ofextmarksMultiple source windows can share the same minimap buffer (one minimap buffer per source buffer).
extmarksare buffer-scoped, so a per-window overlay cannot be cleanly expressed with namespaces.vim.fn.matchaddwith{ window = mwinid }is window-scoped, so each minimap window can have its own independent viewport highlight even when the underlying buffer is shared.Configuration
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.