16

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)
Simon
  • 9,762
  • 15
  • 62
  • 119
  • 1
    FYI http://emacs.stackexchange.com/questions/19532/hybrid-line-number-mode-in-emacs is a similar question (but using https://github.com/coldnew/linum-relative rather than this `dotspacemacs-line-numbers` feature). – phils Jan 19 '16 at 02:41

1 Answers1

32

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 :-)

StreakyCobra
  • 1,991
  • 23
  • 17