Skip to content

Feature Request: Hybrid/Relative Line Numbers in Copy Mode #4838

@pattames

Description

@pattames

Feature Request: Hybrid/Relative Line Numbers in Copy Mode

Summary

Add support for displaying relative line numbers (and optionally hybrid line numbers) in copy mode, similar to Vim's relativenumber and number relativenumber options.

Motivation

When navigating in copy mode with vi-style keybindings, users frequently use motion commands with counts (e.g., 5j, 12k) to jump to specific lines. Currently, calculating the correct count requires mental arithmetic based on the [current/total] indicator or manually counting lines.

Vim solved this ergonomic problem with relative line numbers, which display each line's distance from the cursor. This makes count-based navigation immediate and intuitive—you see "7" next to a line, you type 7j to get there.

Given that tmux's copy mode already embraces vi-style navigation, relative line numbers would be a natural enhancement.

Proposed Behavior

Option 1: Relative line numbers

Display each line's distance from the cursor position:

  3 │ some output above
  2 │ more output
  1 │ line just above cursor
  0 │ ← cursor line
  1 │ line just below cursor
  2 │ more output
  3 │ some output below

Option 2: Hybrid line numbers (preferred)

Show the absolute line number at the cursor, with relative numbers elsewhere (mirrors Vim's set number relativenumber):

  3 │ some output above
  2 │ more output  
  1 │ line just above cursor
847 │ ← cursor line (absolute line number)
  1 │ line just below cursor
  2 │ more output
  3 │ some output below

This provides both context (where am I in the buffer?) and efficient navigation (how far to jump?).

Suggested Configuration

# Possible new options
set -g copy-mode-line-numbers off        # default, current behavior
set -g copy-mode-line-numbers relative   # relative only
set -g copy-mode-line-numbers hybrid     # absolute at cursor, relative elsewhere
set -g copy-mode-line-numbers absolute   # absolute line numbers for all lines

Required information

  • tmux version (tmux -V): tmux 3.6a
  • Platform (uname -sp): Linux x86_64
  • Terminal in use (xterm, rxvt, etc): Alacritty
  • $TERM inside tmux (echo $TERM): tmux-256color
  • $TERM outside tmux (echo $TERM): xterm-256color
  • Logs from tmux (tmux kill-server; tmux -vv new).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions