Replace nlinum with linum
This commit is contained in:
parent
7713cdb0bd
commit
5491fd552e
7 changed files with 19 additions and 36 deletions
|
@ -200,7 +200,7 @@ for function signatures or notes. Run again to clear the header line."
|
||||||
(interactive "r")
|
(interactive "r")
|
||||||
(setq header-line-format
|
(setq header-line-format
|
||||||
(when mark-active
|
(when mark-active
|
||||||
(concat (propertize (format nlinum-format (line-number-at-pos beg))
|
(concat (propertize (format linum-format (line-number-at-pos beg))
|
||||||
'face 'font-lock-comment-face)
|
'face 'font-lock-comment-face)
|
||||||
(let ((content (buffer-substring beg end)))
|
(let ((content (buffer-substring beg end)))
|
||||||
(setq content (replace-regexp-in-string "\n" " " content t t))
|
(setq content (replace-regexp-in-string "\n" " " content t t))
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
'fullboth)))
|
'fullboth)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/toggle-line-numbers ()
|
(defun doom/toggle-line-numbers (&optional arg)
|
||||||
"Toggle `nlinum-mode'."
|
"Toggle `linum-mode'."
|
||||||
(interactive)
|
(interactive "P")
|
||||||
(nlinum-mode (if nlinum-mode -1 +1)))
|
(linum-mode (or arg (if linum-mode -1 +1))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/window-zoom ()
|
(defun doom/window-zoom ()
|
||||||
|
|
|
@ -182,36 +182,25 @@ file."
|
||||||
|
|
||||||
;; Line highlighting
|
;; Line highlighting
|
||||||
(def-package! hl-line ; built-in
|
(def-package! hl-line ; built-in
|
||||||
|
:init
|
||||||
|
(add-hook! (linum-mode nlinum-mode) #'hl-line-mode)
|
||||||
:config
|
:config
|
||||||
;; stickiness doesn't play nice with emacs 25+
|
;; stickiness doesn't play nice with emacs 25+
|
||||||
(setq hl-line-sticky-flag nil
|
(setq hl-line-sticky-flag nil
|
||||||
global-hl-line-sticky-flag nil))
|
global-hl-line-sticky-flag nil))
|
||||||
|
|
||||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
;; Line numbers
|
||||||
;; plugin than the built-in `linum'.
|
(def-package! linum
|
||||||
(def-package! nlinum
|
:commands linum-mode
|
||||||
:commands nlinum-mode
|
:preface (defvar linum-format "%4d ")
|
||||||
:preface
|
|
||||||
(defvar linum-format "%3d ")
|
|
||||||
(defvar nlinum-format "%4d ")
|
|
||||||
:init
|
:init
|
||||||
(add-hook!
|
(add-hook! (prog-mode text-mode)
|
||||||
(markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode
|
(unless (eq major-mode 'org-mode)
|
||||||
nxml-mode snippet-mode php-mode)
|
(call-interactively #'linum-mode)))
|
||||||
#'nlinum-mode)
|
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(defun doom*nlinum-flush (&rest _)
|
(require 'hlinum) ; highlight current line number
|
||||||
"Fix nlinum margins after a change in font."
|
(hlinum-activate))
|
||||||
(dolist (buffer (doom-visible-buffers))
|
|
||||||
(with-current-buffer buffer
|
|
||||||
(when nlinum-mode (nlinum--flush)))))
|
|
||||||
(advice-add #'set-frame-font :after #'doom*nlinum-flush)
|
|
||||||
|
|
||||||
;; Optimization: calculate line number column width beforehand
|
|
||||||
(add-hook! nlinum-mode
|
|
||||||
(setq nlinum--width (length (save-excursion (goto-char (point-max))
|
|
||||||
(format-mode-line "%l"))))))
|
|
||||||
|
|
||||||
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
|
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
|
||||||
;; languages like Lisp.
|
;; languages like Lisp.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
;; core-ui.el
|
;; core-ui.el
|
||||||
(package! highlight-indentation)
|
(package! highlight-indentation)
|
||||||
(package! highlight-numbers)
|
(package! highlight-numbers)
|
||||||
(package! nlinum)
|
(package! hlinum)
|
||||||
(package! rainbow-delimiters)
|
(package! rainbow-delimiters)
|
||||||
(package! visual-fill-column)
|
(package! visual-fill-column)
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
+write-mode)
|
+write-mode)
|
||||||
(setq +write--buffer-mode doom-buffer-mode))
|
(setq +write--buffer-mode doom-buffer-mode))
|
||||||
(text-scale-set (if +write-mode 2 0))
|
(text-scale-set (if +write-mode 2 0))
|
||||||
(nlinum-mode iarg)
|
(doom/toggle-line-numbers iarg)
|
||||||
(setq-local visual-fill-column-center-text +write-mode)
|
(setq-local visual-fill-column-center-text +write-mode)
|
||||||
(visual-fill-column-mode arg)
|
(visual-fill-column-mode arg)
|
||||||
(visual-line-mode arg)
|
(visual-line-mode arg)
|
||||||
|
|
|
@ -15,9 +15,6 @@
|
||||||
(set! :company-backend 'web-mode '(company-web-html company-yasnippet))
|
(set! :company-backend 'web-mode '(company-web-html company-yasnippet))
|
||||||
(setq web-mode-enable-html-entities-fontification t)
|
(setq web-mode-enable-html-entities-fontification t)
|
||||||
|
|
||||||
;; Fix blank line numbers after unfolding
|
|
||||||
(advice-add #'web-mode-fold-or-unfold :after #'nlinum--flush)
|
|
||||||
|
|
||||||
(map! :map web-mode-map
|
(map! :map web-mode-map
|
||||||
(:localleader :n "rt" #'web-mode-element-rename)
|
(:localleader :n "rt" #'web-mode-element-rename)
|
||||||
"M-/" #'web-mode-comment-or-uncomment
|
"M-/" #'web-mode-comment-or-uncomment
|
||||||
|
|
|
@ -90,10 +90,7 @@
|
||||||
(doom-themes-neotree-config)
|
(doom-themes-neotree-config)
|
||||||
(setq doom-neotree-enable-variable-pitch t
|
(setq doom-neotree-enable-variable-pitch t
|
||||||
doom-neotree-file-icons 'simple
|
doom-neotree-file-icons 'simple
|
||||||
doom-neotree-line-spacing 2)
|
doom-neotree-line-spacing 2))
|
||||||
|
|
||||||
;; Add line-highlighting to nlinum
|
|
||||||
(doom-themes-nlinum-config))
|
|
||||||
|
|
||||||
|
|
||||||
;; Flashes the line around the cursor after any motion command that might
|
;; Flashes the line around the cursor after any motion command that might
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue