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")
|
||||
(setq header-line-format
|
||||
(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)
|
||||
(let ((content (buffer-substring beg end)))
|
||||
(setq content (replace-regexp-in-string "\n" " " content t t))
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
'fullboth)))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/toggle-line-numbers ()
|
||||
"Toggle `nlinum-mode'."
|
||||
(interactive)
|
||||
(nlinum-mode (if nlinum-mode -1 +1)))
|
||||
(defun doom/toggle-line-numbers (&optional arg)
|
||||
"Toggle `linum-mode'."
|
||||
(interactive "P")
|
||||
(linum-mode (or arg (if linum-mode -1 +1))))
|
||||
|
||||
;;;###autoload
|
||||
(defun doom/window-zoom ()
|
||||
|
|
|
@ -182,36 +182,25 @@ file."
|
|||
|
||||
;; Line highlighting
|
||||
(def-package! hl-line ; built-in
|
||||
:init
|
||||
(add-hook! (linum-mode nlinum-mode) #'hl-line-mode)
|
||||
:config
|
||||
;; stickiness doesn't play nice with emacs 25+
|
||||
(setq hl-line-sticky-flag nil
|
||||
global-hl-line-sticky-flag nil))
|
||||
|
||||
;; Line number column. A faster (or equivalent, in the worst case) line number
|
||||
;; plugin than the built-in `linum'.
|
||||
(def-package! nlinum
|
||||
:commands nlinum-mode
|
||||
:preface
|
||||
(defvar linum-format "%3d ")
|
||||
(defvar nlinum-format "%4d ")
|
||||
;; Line numbers
|
||||
(def-package! linum
|
||||
:commands linum-mode
|
||||
:preface (defvar linum-format "%4d ")
|
||||
:init
|
||||
(add-hook!
|
||||
(markdown-mode prog-mode scss-mode web-mode conf-mode groovy-mode
|
||||
nxml-mode snippet-mode php-mode)
|
||||
#'nlinum-mode)
|
||||
(add-hook! (prog-mode text-mode)
|
||||
(unless (eq major-mode 'org-mode)
|
||||
(call-interactively #'linum-mode)))
|
||||
|
||||
:config
|
||||
(defun doom*nlinum-flush (&rest _)
|
||||
"Fix nlinum margins after a change in font."
|
||||
(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"))))))
|
||||
(require 'hlinum) ; highlight current line number
|
||||
(hlinum-activate))
|
||||
|
||||
;; Helps us distinguish stacked delimiter pairs. Especially in parentheses-drunk
|
||||
;; languages like Lisp.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
;; core-ui.el
|
||||
(package! highlight-indentation)
|
||||
(package! highlight-numbers)
|
||||
(package! nlinum)
|
||||
(package! hlinum)
|
||||
(package! rainbow-delimiters)
|
||||
(package! visual-fill-column)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
+write-mode)
|
||||
(setq +write--buffer-mode doom-buffer-mode))
|
||||
(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)
|
||||
(visual-fill-column-mode arg)
|
||||
(visual-line-mode arg)
|
||||
|
|
|
@ -15,9 +15,6 @@
|
|||
(set! :company-backend 'web-mode '(company-web-html company-yasnippet))
|
||||
(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
|
||||
(:localleader :n "rt" #'web-mode-element-rename)
|
||||
"M-/" #'web-mode-comment-or-uncomment
|
||||
|
|
|
@ -90,10 +90,7 @@
|
|||
(doom-themes-neotree-config)
|
||||
(setq doom-neotree-enable-variable-pitch t
|
||||
doom-neotree-file-icons 'simple
|
||||
doom-neotree-line-spacing 2)
|
||||
|
||||
;; Add line-highlighting to nlinum
|
||||
(doom-themes-nlinum-config))
|
||||
doom-neotree-line-spacing 2))
|
||||
|
||||
|
||||
;; Flashes the line around the cursor after any motion command that might
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue