I know that you can toggle line numbers with the key combination SPC + t + l
but it changes back to absolute line numbers when restarting Doom Emacs. How can I configure Doom Emacs to set relative line numbers every time I start emacs?
By default, Emacs displays the current line number of the point in the mode line. You can toggle this feature off or on with the command M-x line-number-mode , or by setting the variable line-number-mode .
Doom is a configuration framework for GNU Emacs tailored for Emacs bankruptcy veterans who want less framework in their frameworks, a modicum of stability (and reproducibility) from their package manager, and the performance of a hand rolled config (or better).
As of commit a7da9a4 doom-line-numbers-style
has been removed. The correct way of setting line number type is to set the display-line-numbers-type
variable. This is part of Emacs itself and as such will work outside of doom too.
To answer op's question, the way to set line numbering to be relative is to add the following snippet to your configuration file which in the case of doom is ~/.doom.d/config.el
.
(setq display-line-numbers-type 'relative)
Assuming on latest version, which is v2.0.9 at the time of writing, the preferred way would be to set the doom-line-numbers-style
to 'relative
in your own private config. Simply add (setq doom-line-numbers-style 'relative)
to that config. This will configure emacs to start with relative line numbering.
Note however that toggling line numbers with SPC t l
will still change it back to absolute line numbering. To toggle relative line numbering, you need to provide a universal argument to the toggle command. In this case, you'd have to do SPC u SPC t l
. The SPC u
there stands for the universal/prefix argument.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With