blob: c99ec208350dc2f53e311647861b4a1fc6e1a088 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
;;; init-nlinum.el --- .Emacs Configuration -*- lexical-binding: t -*-
;;; Commentary:
;;
;;; Code:
;;----------------------------------------------------------------------------
;; Line numbers
;;----------------------------------------------------------------------------
;; Linum snippets from: https://www.emacswiki.org/emacs/LineNumbers
(use-package linum
:config
(defun my-linum-get-format ()
"Defines LINUM-GET-FORMAT"
(let* ((width (1+ (length (number-to-string
(count-lines (point-min) (point-max))))))
(format (concat "%" (number-to-string width) "d \u2502")))
(setq my-linum-format-string format)))
(add-hook 'linum-before-numbering-hook 'my-linum-get-format)
(defun my-linum-format (line-number)
"Defines LINE-FORMAT"
(propertize (format my-linum-format-string line-number) 'face
(if (eq line-number my-current-line)
'my-linum-hl
'linum)))
(setq linum-format 'my-linum-format)
(defadvice linum-update (around my-linum-update)
"Defines LINUM-UPDATE for update lines"
(let ((my-current-line (line-number-at-pos)))
ad-do-it))
(ad-activate 'linum-update)
;; Colors line active
;; set in file init-theme.el
;; for example:
;; (defface my-linum-hl
;; '((t :background "gray20" :foreground "gold"))
;; "Face for the currently active Line number"
;; :group 'linum)
;; )
:bind
(([f6] . linum-mode)))
(provide 'init-linum)
;; Local Variables:
;; byte-compile-warnings: (not free-vars)
;; End:
;;; init-linum.el ends here
|