Add `winum'

I only rebind winum-select-window-* in graphical buffers because that's
apparently the only place where C-[n] is the same as M-[n].
This commit is contained in:
Case Duckworth 2021-05-03 15:12:44 -05:00
parent cadba81fbf
commit ddda04e26f
2 changed files with 25 additions and 0 deletions

20
init.el
View File

@ -950,6 +950,7 @@ if ripgrep is installed, otherwise `consult-grep'."
simple-modeline-segment-position
simple-modeline-segment-word-count)
(simple-modeline-segment-misc-info
acdw-modeline/winum
acdw-modeline/text-scale
simple-modeline-segment-process
acdw-modeline/god-mode-indicator
@ -1011,6 +1012,25 @@ if ripgrep is installed, otherwise `consult-grep'."
(which-key-setup-minibuffer)
(which-key-mode +1))
(setup (:straight winum)
(:option winum-auto-setup-mode-line nil
winum-ignored-buffers '(" *which-key*"))
(when (display-graphic-p)
(:with-map winum-keymap
(:bind "M-0" winum-select-window-0-or-10
"M-1" winum-select-window-1
"M-2" winum-select-window-2
"M-3" winum-select-window-3
"M-4" winum-select-window-4
"M-5" winum-select-window-5
"M-6" winum-select-window-6
"M-7" winum-select-window-7
"M-8" winum-select-window-8
"M-9" winum-select-window-9)))
(winum-mode +1))
(setup (:straight zzz-to-char)
(defun acdw/zzz-up-to-char (prefix)
"Call `zzz-up-to-char', unless issued a PREFIX, in which case

View File

@ -88,4 +88,9 @@ indicator in the mode-line."
(if-let ((backend (vc-backend buffer-file-name)))
(substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))))
(defun acdw-modeline/winum ()
(when (and (bound-and-true-p winum-mode)
(> winum--window-count 1))
(format winum-format (winum-get-number-string))))
(provide 'acdw-modeline)