aboutsummaryrefslogtreecommitdiffstats
path: root/_emacs.d/personal/30-linum.el
blob: cba26b80150573eb86f13c69a388edb3ce7389a1 (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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
;;; ~/.emacs.d/personal/30-linum.el --- Configure linum-mode
;;
;; -*- mode: emacs-lisp -*-
;; vim: set ts=8 sw=2 tw=0 fenc=utf-8 ft=lisp:
;;
;; Credits:
;; [1] https://stackoverflow.com/a/3879664/4856091
;; [2] https://github.com/redguardtoo/emacs.d - lisp/init-linum-mode.el
;;
;; Aaron LI
;; 2016-02-24
;;

;;; Commentary:
;; Configure linum-mode for Emacs.

;;; Code:

;; Turn on `linum-mode' globally
(global-linum-mode t)

;; Separte line numbers from text
(setq linum-format "%4d\u2502")

;; Inhibit `linum-mode' for following specified modes
(setq linum-mode-inhibit-modes-list '(eshell-mode
                                      shell-mode
                                      dictionary-mode
                                      erc-mode
                                      browse-kill-ring-mode
                                      Buffer-menu-mode
                                      etags-select-mode
                                      dired-mode
                                      help-mode
                                      ;text-mode
                                      fundamental-mode
                                      jabber-roster-mode
                                      jabber-chat-mode
                                      inferior-js-mode
                                      inferior-python-mode
                                      inferior-scheme-mode
                                      twittering-mode
                                      compilation-mode
                                      weibo-timeline-mode
                                      woman-mode
                                      Info-mode
                                      calc-mode
                                      calc-trail-mode
                                      comint-mode
                                      inf-ruby-mode
                                      gud-mode
                                      org-mode
                                      vc-git-log-edit-mode
                                      log-edit-mode
                                      term-mode
                                      w3m-mode
                                      speedbar-mode
                                      mu4e-main-mode
                                      mu4e-headers-mode
                                      mu4e-view-mode
                                      mu4e-compose-mode
                                      gnus-group-mode
                                      gnus-summary-mode
                                      gnus-article-mode
                                      calendar-mode))
(defadvice linum-on (around linum-on-inhibit-for-modes)
           "Stop the load of linum-mode for some major modes."
           (unless (member major-mode linum-mode-inhibit-modes-list)
             ad-do-it))
(ad-activate 'linum-on)