Enabled relative line numbers.

Currently done in a bit of a hacky way, I might try to turn it into a package at some point.
This commit is contained in:
2012-03-13 14:44:01 +00:00
parent 25e17c915e
commit 08f4d3eecf

View File

@@ -44,3 +44,15 @@
(xterm-mouse-mode 1)
(global-set-key [mouse-4] 'scroll-down-line)
(global-set-key [mouse-5] 'scroll-up-line))
;; Relative line numbers -- from: http://stackoverflow.com/a/6928112/42146
(defvar my-linum-current-line-number 0)
(setq linum-format 'my-linum-relative-line-numbers)
(defun my-linum-relative-line-numbers (line-number)
(propertize
(number-to-string (abs (- line-number my-linum-current-line-number)))
'face 'linum))
(defadvice linum-update (around my-linum-update)
(let ((my-linum-current-line-number (line-number-at-pos)))
ad-do-it))
(ad-activate 'linum-update)