Add support for line numbers in copy mode. A new copy-mode-line-numbers

option has the following modes: off, default (tmux's normal line
numbering where 0 is the top visible line), absolute (first line in
history is 1), relative (relative to the cursor) and hybrid (current
line is absolute, others relative). Also adds
copy-mode-line-number-style and copy-mode-current-line-number-style to
set the style of the line numbers. When copy mode is entered with the
mouse, line numbers stay off.

From Leo Henon in GitHub issue 5025.
This commit is contained in:
nicm
2026-05-01 09:44:42 +00:00
parent a2acf0f7cf
commit 524f283cc6
6 changed files with 419 additions and 26 deletions

48
tmux.1
View File

@@ -5173,6 +5173,52 @@ see the
.Sx STYLES
section.
.Pp
.It Ic copy\-mode\-current\-line\-number\-style Ar style
Set style of current line number in copy mode.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
.Pp
.It Ic copy\-mode\-line\-number\-style Ar style
Set style of line numbers in copy mode.
For how to specify
.Ar style ,
see the
.Sx STYLES
section.
.Pp
.It Xo Ic copy\-mode\-line\-numbers
.Op Ic off | default | absolute | relative | hybrid
.Xc
Show line numbers in copy mode.
.Ic off
hides line numbers,
.Ic default
shows line numbers matching the copy mode position indicator and
.Ic goto\-line ,
.Ic absolute
shows absolute line numbers,
.Ic relative
shows line numbers relative to the cursor, and
.Ic hybrid
shows the current line number as absolute and other line numbers as
relative.
With
.Ic off
or
.Ic default ,
the position indicator and
.Ic goto\-line
use the same numbering;
with
.Ic absolute ,
.Ic relative
and
.Ic hybrid ,
they use absolute line numbers.
.Pp
.It Ic mode\-style Ar style
Set window modes style.
For how to specify
@@ -6308,6 +6354,8 @@ The following variables are available, where appropriate:
.It Li "copy_cursor_word" Ta "" Ta "Word under cursor in copy mode"
.It Li "copy_cursor_x" Ta "" Ta "Cursor X position in copy mode"
.It Li "copy_cursor_y" Ta "" Ta "Cursor Y position in copy mode"
.It Li "copy_position" Ta "" Ta "Position shown in the copy mode indicator"
.It Li "copy_position_limit" Ta "" Ta "Limit shown in the copy mode indicator"
.It Li "current_file" Ta "" Ta "Current configuration file"
.It Li "cursor_character" Ta "" Ta "Character at cursor in pane"
.It Li "cursor_colour" Ta "" Ta "Cursor colour in pane"