Relative line numbers anchored to selection start in select mode #16162
Unanswered
cried-nutty-won
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Currently, line-number = "relative" always computes the displayed distance from the primary cursor position — the moving end of the selection. This is very useful for motions like 5j / 5k, but it becomes less useful once a selection spans multiple lines: you lose the ability to see at a glance how many lines are currently selected without doing mental subtraction between the anchor line and the cursor line.
Proposal: while in select mode (and only in select mode — normal/insert mode would keep the current behavior), have the relative line-number gutter compute distance from the selection anchor instead of the primary cursor. Concretely, the line containing the anchor would show 0, and every other selected (or unselected) line's relative number would count outward from that anchor line, rather than from wherever the primary cursor currently sits.
This would let the line-number column double as a live "how many lines have I selected so far" indicator, without needing to add a separate statusline element or do math in your head. It fits naturally into the existing relative-numbering mechanism rather than requiring a whole new gutter or statusline field.
Happy to clarify further or discuss alternative implementations (e.g. only changing the sign, or only kicking in once the selection spans more than one line).
All reactions