spaceline显示window-number和显示evil-state似乎是互斥的,于是想在当前窗口显示evil-state,其余窗口显示window-number。
尝试了自定义segment,然而并没有生效。
(spaceline-define-segment evil-state-focus
"The current evil state in focused window. Requires
`evil-mode' to be enabled."
(when (bound-and-true-p evil-local-mode)
(let ((tag (evil-state-property evil-state :tag t)))
(s-trim (if (stringp tag) tag (funcall tag)))))
:when active
)
(spaceline-define-segment window-number-focus
"The current window number in focused window.
Requires either `winum-mode' or `window-numbering-mode' to be
enabled."
(let* ((num (cond
((bound-and-true-p winum-mode)
(winum-get-number))
((bound-and-true-p window-numbering-mode)
(window-numbering-get-number))
(t nil)))
(str (when num (int-to-string num))))
(when num
(if spaceline-window-numbers-unicode
(spaceline--unicode-number str)
(propertize str 'face 'bold))))
:when inactive)
两个segment是从spaceline-segment.el
中直接复制过来的,加上了:when
参数,但实际显示没有效果,就连定义完全一致,但名字不同的两个segment都无法显示。spaceline的两个segment在定义的时候还用了什么黑魔法?