[Emacs] Use nlinum-mode

This commit is contained in:
2017-03-18 11:44:04 -07:00
parent 9496c2c103
commit 0cde170eac

View File

@@ -998,6 +998,7 @@ This was stolen from https://github.com/jwiegley/dot-emacs
(,mode-name ,disable-value))) (,mode-name ,disable-value)))
(imalison:disable-mode-hook linum-mode) (imalison:disable-mode-hook linum-mode)
(imalison:disable-mode-hook nlinum-mode)
(imalison:disable-mode-hook yas-minor-mode) (imalison:disable-mode-hook yas-minor-mode)
#+END_SRC #+END_SRC
** Other ** Other
@@ -1141,12 +1142,27 @@ I keep it around just in case I need it.
(line-number-mode t) (line-number-mode t)
(column-number-mode t) (column-number-mode t)
#+END_SRC #+END_SRC
Linum can be really slow on large files so it does not make sense to *** nlinum
have it on by default. Its probably safe to turn it on when in a Linum/NLinum can be really slow on large files so it does not make sense to have
programming mode. it on by default. Its probably safe to turn it on when in a programming mode.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(global-linum-mode -1) (global-linum-mode -1)
(add-hook 'prog-mode-hook (lambda () (linum-mode t))) #+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package nlinum
:demand t
:config
(progn
(add-hook 'prog-mode-hook (lambda () (nlinum-mode t)))
(defun imalison-nlinum-mode-hook ()
(when nlinum-mode
(setq-local nlinum-format
(concat "%" (number-to-string
;; Guesstimate number of buffer lines.
(ceiling (log (max 1 (/ (buffer-size) 80)) 10)))
"d"))))
(add-hook 'nlinum-mode-hook #'imalison-nlinum-mode-hook)))
#+END_SRC #+END_SRC
** Backups ** Backups
*** Put them all in one directory *** Put them all in one directory