Skip to content

Add line number gutter toggle (L key) #20

@rashpile

Description

@rashpile

It would be useful to see line numbers in the diff view, similar to how IntelliJ IDEA shows side-by-side old/new line numbers in the gutter.

Why:

  • Mental map of the file — line numbers help build a spatial sense of where changes sit in the file, making it easier to orient and find them in an editor
  • Code review context — when discussing a diff with teammates, you can reference exact line numbers ("check line 142") instead of describing the location
  • Matching with editor — quickly jump to a specific line in your editor after spotting something in the diff
  • Matching with CI/linter output — linter warnings and test failures reference line numbers; seeing them in the diff helps locate the issue without mental math from hunk headers

Proposed behavior:

  • L key toggles a line number gutter on/off (runtime only, no CLI flag)
  • Two columns before the existing +/- prefix: old line number (left), new line number (right)
  • Context lines show both numbers, added lines show only new, removed lines show only old
  • Numbers are right-aligned with dynamic column width based on the file's max line number

Example:

▶ 25 32 + content here
▶ 40 - removed line
▶ 40 + added line
▶ 41 42 context line

  • Works in normal, wrapped, and collapsed modes
  • '#' icon in the status bar indicates active state
  • Numbers styled with the existing muted color (color-muted)

Happy to submit a PR if this sounds reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions