Spacemacs hybrid line numbers

Simon picture Simon · Jan 18, 2016 · Viewed 9.6k times · Source

How do I get hybrid line numbering (relative line numbers, but the current line shows the absolute line number instead of 0) in spacemacs for all files?

I tried setting relative line numbers in user-config but that doesn't seem to be working, and can't figure out how to replace the 0 in relative mode either:

(global-linum-mode)
(setq-default dotspacemacs-line-numbers 'relative)

Answer

StreakyCobra picture StreakyCobra · Jan 19, 2016

The dotspacemacs-line-numbers variable already exists in your .spacemacs, in the dotspacemacs/init function. If it is not the case you can update your .spacemacs to the last template with the help of SPC f e D.

Change its value to 'relative, as in:

;; If non nil line numbers are turned on in all `prog-mode' and `text-mode'
;; derivatives. If set to `relative', also turns on relative line numbers.
;; (default nil)
dotspacemacs-line-numbers 'relative

Then remove the two lines you added in your dotspacemacs/user-config. All you need is to change the variable as explained above, it will take care of applying the changes for you :-)