-
Notifications
You must be signed in to change notification settings - Fork 0
/
zy-linum.el
37 lines (26 loc) · 1.2 KB
/
zy-linum.el
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
;;; zy-linum.el --- Line number display. -*- lexical-binding: t -*-
;;; Commentary:
;; This file provides the `+linum' module of the configuration.
;; Line number is displayed via the `display-line-numbers-mode'. It can be
;; toggled by "<leader> y l".
;;; Code:
(require 'zylib)
;; Enable line numbers for any non-special mode.
(add-hook! 'after-change-major-mode-hook
(defun +linum-activate-h (&rest _)
"Activate line numbers when appropriate."
(unless (or (derived-mode-p 'special-mode)
(derived-mode-p 'dired-mode))
(display-line-numbers-mode 1))))
(after! 'display-line-numbers
;; Explicitly define a width to reduce the cost of on-the-fly computation. 4 is
;; a good default, as most text files do not exceed 10k lines.
(setq display-line-numbers-width 4)
;; Show absolute line numbers for narrowed regions to make it easier to tell
;; the buffer is narrowed, and where you are, exactly.
(setq display-line-numbers-widen t)
;; Set this value for a consistent line number width. It should be larger than
;; the number of lines a window normally has. Read the documentation.
(setq display-line-numbers-width-start 60))
(provide 'zy-linum)
;;; zy-linum.el ends here