Move window-numbering package config into its own init function
This commit is contained in:
parent
89fb5a46d6
commit
1a84a5a983
1 changed files with 50 additions and 40 deletions
|
@ -1553,40 +1553,7 @@ determine the state to enable when escaping from the insert state.")
|
|||
(use-package powerline
|
||||
:init
|
||||
(progn
|
||||
(use-package window-numbering
|
||||
:ensure window-numbering
|
||||
:init
|
||||
(progn
|
||||
(evil-leader/set-key
|
||||
"0" 'select-window-0
|
||||
"1" 'select-window-1
|
||||
"2" 'select-window-2
|
||||
"3" 'select-window-3
|
||||
"4" 'select-window-4
|
||||
"5" 'select-window-5
|
||||
"6" 'select-window-6
|
||||
"7" 'select-window-7
|
||||
"8" 'select-window-8
|
||||
"9" 'select-window-9)
|
||||
(window-numbering-mode 1)))
|
||||
|
||||
(defun spacemacs/window-number ()
|
||||
"Return the number of the window."
|
||||
(let ((num (window-numbering-get-number-string)))
|
||||
(cond
|
||||
((not dotspacemacs-mode-line-unicode-symbols) (concat " " num " "))
|
||||
((equal num "1") " ➊ ")
|
||||
((equal num "2") " ➋ ")
|
||||
((equal num "3") " ➌ ")
|
||||
((equal num "4") " ➍ ")
|
||||
((equal num "5") " ➎ ")
|
||||
((equal num "6") " ❻ ")
|
||||
((equal num "7") " ➐ ")
|
||||
((equal num "8") " ➑ ")
|
||||
((equal num "9") " ➒ ")
|
||||
((equal num "0") " ➓ ")
|
||||
(t (concat " " num " ")))))
|
||||
|
||||
;; Custom format of minor mode lighters, they are separated by a pipe.
|
||||
(defpowerline spacemacs-powerline-minor-modes
|
||||
(mapconcat (lambda (mm)
|
||||
(propertize
|
||||
|
@ -1629,12 +1596,17 @@ determine the state to enable when escaping from the insert state.")
|
|||
(setq-default powerline-height height))
|
||||
(setq-default powerline-default-separator 'wave)
|
||||
|
||||
(setq-default mode-line-format '("%e" (:eval
|
||||
(setq-default
|
||||
mode-line-format
|
||||
'("%e"
|
||||
(:eval
|
||||
(let* ((active (powerline-selected-window-active))
|
||||
(line-face (if active 'mode-line 'mode-line-inactive))
|
||||
(face1 (if active 'powerline-active1 'powerline-inactive1))
|
||||
(face2 (if active 'powerline-active2 'powerline-inactive2))
|
||||
(state-face (if active (spacemacs/current-state-face) face2))
|
||||
(window-numberingp (and (boundp 'window-numbering-mode)
|
||||
(symbol-value window-numbering-mode)))
|
||||
(batteryp (and (boundp 'fancy-battery-mode)
|
||||
(symbol-value fancy-battery-mode)))
|
||||
(battery-face (if batteryp (fancy-battery-powerline-face)))
|
||||
|
@ -1651,10 +1623,10 @@ determine the state to enable when escaping from the insert state.")
|
|||
powerline-default-separator
|
||||
(cdr powerline-default-separator-dir))))
|
||||
(lhs (append
|
||||
(list
|
||||
;; window number
|
||||
;; (funcall separator-left state-face face1)
|
||||
(powerline-raw (spacemacs/window-number) state-face))
|
||||
(if window-numberingp
|
||||
(list (powerline-raw (spacemacs/window-number) state-face))
|
||||
(list (powerline-raw (evil-state-property evil-state :tag t) state-face)))
|
||||
(if (and active anzu--state)
|
||||
(list
|
||||
(funcall separator-right state-face face1)
|
||||
|
@ -2005,6 +1977,44 @@ determine the state to enable when escaping from the insert state.")
|
|||
:defer t
|
||||
:config (spacemacs|diminish whitespace-mode " Ⓦ" " W")))
|
||||
|
||||
(defun spacemacs/init-window-numbering ()
|
||||
(use-package window-numbering
|
||||
;; not deferred on puprose
|
||||
:init
|
||||
(progn
|
||||
(when (configuration-layer/layer-declaredp 'powerline)
|
||||
(defun window-numbering-install-mode-line (&optional position)
|
||||
"Do nothing, the display is handled by the powerline."))
|
||||
(evil-leader/set-key
|
||||
"0" 'select-window-0
|
||||
"1" 'select-window-1
|
||||
"2" 'select-window-2
|
||||
"3" 'select-window-3
|
||||
"4" 'select-window-4
|
||||
"5" 'select-window-5
|
||||
"6" 'select-window-6
|
||||
"7" 'select-window-7
|
||||
"8" 'select-window-8
|
||||
"9" 'select-window-9)
|
||||
(window-numbering-mode 1))
|
||||
|
||||
(defun spacemacs/window-number ()
|
||||
"Return the number of the window."
|
||||
(let ((num (window-numbering-get-number-string)))
|
||||
(cond
|
||||
((not dotspacemacs-mode-line-unicode-symbols) (concat " " num " "))
|
||||
((equal num "1") " ➊ ")
|
||||
((equal num "2") " ➋ ")
|
||||
((equal num "3") " ➌ ")
|
||||
((equal num "4") " ➍ ")
|
||||
((equal num "5") " ➎ ")
|
||||
((equal num "6") " ❻ ")
|
||||
((equal num "7") " ➐ ")
|
||||
((equal num "8") " ➑ ")
|
||||
((equal num "9") " ➒ ")
|
||||
((equal num "0") " ➓ ")
|
||||
(t (concat " " num " ")))))))
|
||||
|
||||
(defun spacemacs/init-yasnippet ()
|
||||
(use-package yasnippet
|
||||
:commands yas-global-mode
|
||||
|
|
Reference in a new issue