Add display-line-numbers support in Emacs 26 #59
This commit is contained in:
parent
e87d278811
commit
c0bfaec9d4
3 changed files with 17 additions and 4 deletions
|
@ -13,7 +13,9 @@
|
|||
(defun doom/toggle-line-numbers (&optional arg)
|
||||
"Toggle `linum-mode'."
|
||||
(interactive "P")
|
||||
(cond ((featurep 'nlinum)
|
||||
(cond ((boundp 'display-line-numbers)
|
||||
(setq display-line-numbers (not display-line-numbers)))
|
||||
((featurep 'nlinum)
|
||||
(nlinum-mode (or arg (if nlinum-mode -1 +1))))
|
||||
((featurep 'linum)
|
||||
(linum-mode (or arg (if linum-mode -1 +1))))
|
||||
|
|
|
@ -256,6 +256,13 @@ local value, whether or not it's permanent-local. Therefore, we cycle
|
|||
(add-hook! '(doom-post-init-hook minibuffer-setup-hook)
|
||||
#'doom|no-fringes-in-minibuffer)
|
||||
|
||||
;; line numbers in newer version of Emacs
|
||||
(when (boundp 'display-line-numbers)
|
||||
(defun doom|init-line-numbers ()
|
||||
(unless (eq major-mode 'org-mode)
|
||||
(setq display-line-numbers t)))
|
||||
(add-hook! (prog-mode text-mode) #'doom|init-line-numbers))
|
||||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
|
@ -318,8 +325,10 @@ local value, whether or not it's permanent-local. Therefore, we cycle
|
|||
(add-hook 'evil-visual-state-exit-hook #'hl-line-mode)))
|
||||
|
||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
||||
;; plugin than the built-in `linum'.
|
||||
;; plugin than the built-in `linum'. This will be ignored if you're using Emacs
|
||||
;; 26.1+, which has native line number support.
|
||||
(def-package! nlinum
|
||||
:unless (boundp 'display-line-numbers)
|
||||
:commands nlinum-mode
|
||||
:init
|
||||
(defun doom|init-nlinum-mode ()
|
||||
|
@ -357,6 +366,7 @@ local value, whether or not it's permanent-local. Therefore, we cycle
|
|||
|
||||
;; Fixes disappearing line numbers in nlinum and other quirks
|
||||
(def-package! nlinum-hl
|
||||
:unless (boundp 'display-line-numbers)
|
||||
:after nlinum
|
||||
:config
|
||||
;; With `markdown-fontify-code-blocks-natively' enabled in `markdown-mode',
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
(package! fringe-helper)
|
||||
(package! highlight-indentation)
|
||||
(package! highlight-numbers)
|
||||
(unless (boundp 'display-line-numbers)
|
||||
(package! nlinum)
|
||||
(package! nlinum-hl)
|
||||
(package! nlinum-hl))
|
||||
(package! rainbow-delimiters)
|
||||
(package! vi-tilde-fringe)
|
||||
(package! visual-fill-column)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue