Home

relativenumber

Relativenumber is a display option for Vim and Neovim. When enabled, line numbers on the left edge are shown relative to the current cursor line. The line with the cursor shows its true number, while the other lines show the number of lines away from the cursor.

To see both absolute and relative numbers on all lines, users typically enable both number and relativenumber.

Usage tips: Relative numbers are handy for commands that rely on a line count, such as moving

Compatibility: The option exists in Vim and Neovim and is widely supported across modern terminals. It is

Configuration:
Add
to
vimrc:
set
number
relativenumber.
The
short
form
set
nu
rnu
is
common.
You
can
toggle
dynamically
with
:set
relativenumber!
and
the
current
state
can
be
checked
with
:set
relativenumber?.
The
option
is
window-local;
you
can
enable
it
per
window.
with
5j
or
3k,
since
the
displayed
distances
indicate
how
far
you
will
move.
They
do
not
affect
editing
semantics.
If
you
prefer
absolute
numbers
only,
disable
relativenumber.
a
purely
display
feature
and
does
not
alter
how
editing
commands
behave
beyond
changing
how
line
numbers
are
shown.