mirror of
https://github.com/jimeh/.emacs.d.git
synced 2026-02-19 13:46:41 +00:00
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:
12
behavior.el
12
behavior.el
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user