One of the new features in Emacs 26 is display-line-numbers-mode
:
Emacs now supports optional display of line numbers in the buffer.
This is similar to what linum-mode provides, but much faster and
doesn't usurp the display margin for the line numbers. Customize the
buffer-local variable 'display-line-numbers' to activate this optional
display. Alternatively, you can use the `display-line-numbers-mode'
minor mode or the global `global-display-line-numbers-mode'. When
using these modes, customize `display-line-numbers-type' with the same
value as you would use with `display-line-numbers'.
Up to now, I've been using linum-relativenumber to get both relative and absolute line numbers at the same time. Here is how it looks:
Now that the new display-line-numbers-mode
feature is here, with promises to be much faster, I thought maybe I could switch to using that instead.
But I haven't been able to figure out how to get it to show both relative and absolute line numbers, since the help for display-line-numbers-type
points to display-line-number
, which says:
Non-nil means display line numbers.
If the value is t, display the absolute number of each line of a buffer
shown in a window. Absolute line numbers count from the beginning of
the current narrowing, or from buffer beginning. If the value is
‘relative’, display for each line not containing the window’s point its
relative number instead, i.e. the number of the line relative to the
line showing the window’s point.
and there doesn't seem to be a both
setting.
Can anyone suggest a way to get both relative and abolute line numbers using the new display-line-numbers-mode
feature?
display-line-numbers-mode
instead.nlinum
or similar.