feat: add dynamic_win_width option for tags window - #199
Open
awerebea wants to merge 4 commits into
Open
Conversation
Add `dynamic_win_width` setting that accepts a fraction (0–1) to calculate the tags window width based on the longest tag path. - Add `dynamic_win_width` setting to DEFAULT_SETTINGS (false by default) - Compute display length per tag respecting relative/basename styles - Cap computed width at `dynamic_win_width * vim.o.columns` - Use `win_opts.width` as minimum width - Pass computed win_opts to `open_window` via new optional parameter
When calculating max display length for tag alignment, include the tag's name length and padding offset (+2) so that virt_text does not overflow when name_pos is "start".
- Add dynamic_win_width option to default settings in docs - Add table of contents entry for dynamic window width - Document width calculation algorithm and overhead values - Add configuration example with annotated win_opts - Add worked numeric example showing clamp behaviour
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
Add a
dynamic_win_widthsetting that automatically sizes the tags window to fit the longest tagpath rather than using a fixed width.
How it works:
numberbetween 0 and 1 (exclusive) representing the maximum width as a fraction ofthe editor width, or
false(default) to keep the existing static-width behavior.win_opts.widthis repurposed as the minimum floor: the computed width is clamped betweenwin_opts.widthandvim.o.columns * dynamic_win_width.relativestrips the scope path prefix,basenameuses only the filename), optional tag names rendered as EOL virtual text, iconpadding, and the index/separator overhead (
/001+ icon = ~10 cols with icons, ~7 without).open_window(content, win_opts?)gains an optional second parameter so computed opts are passedper-call without mutating global settings.
No breaking changes. Default is
false; existing configs behave identically.