Refactor segments. Only show global and input in active window.

This commit is contained in:
Vincent Zhang 2018-12-05 03:50:50 +08:00
parent c0b5f1c0ab
commit 420285ae5f

View file

@ -825,6 +825,17 @@ directory, the file name, and its state (modified, read-only or non-existent)."
" ")) " "))
;;
;; remote host
;;
(doom-modeline-def-segment remote-host
"Hostname for remote buffers."
(when default-directory
(when-let ((host (file-remote-p default-directory 'host)))
(concat "@" host))))
;; ;;
;; major-mode ;; major-mode
;; ;;
@ -860,6 +871,27 @@ mouse-3: Toggle minor modes"
"The process info." "The process info."
mode-line-process) mode-line-process)
;;
;; minor modes
;;
(doom-modeline-def-segment minor-modes
(when doom-modeline-minor-modes
`((:propertize (" " minor-mode-alist " ")
mouse-face mode-line-highlight
help-echo "Minor mode\n\
mouse-1: Display minor mode menu\n\
mouse-2: Show help for minor mode\n\
mouse-3: Toggle minor modes"
local-map ,mode-line-minor-mode-keymap)
(:propertize "%n"
mouse-face mode-line-highlight
help-echo "mouse-2: Remove narrowing from buffer"
local-map ,(make-mode-line-mouse-map
'mouse-2 #'mode-line-widen)))))
;; ;;
;; vcs ;; vcs
;; ;;
@ -1275,32 +1307,14 @@ Requires `eyebrowse-mode' to be enabled."
"")) ""))
;;
;; minor modes
;;
(doom-modeline-def-segment minor-modes
(when doom-modeline-minor-modes
`((:propertize (" " minor-mode-alist " ")
mouse-face mode-line-highlight
help-echo "Minor mode\n\
mouse-1: Display minor mode menu\n\
mouse-2: Show help for minor mode\n\
mouse-3: Toggle minor modes"
local-map ,mode-line-minor-mode-keymap)
(:propertize "%n"
mouse-face mode-line-highlight
help-echo "mouse-2: Remove narrowing from buffer"
local-map ,(make-mode-line-mouse-map
'mouse-2 #'mode-line-widen)))))
;; ;;
;; global ;; global
;; ;;
(doom-modeline-def-segment global (doom-modeline-def-segment global
"For the time string and whatever uses global-mode-string." "For the time string and whatever uses global-mode-string."
(if (< 0 (length global-mode-string)) (if (and (doom-modeline--active)
(< 0 (length global-mode-string)))
'("" global-mode-string " ") '("" global-mode-string " ")
"")) ""))
@ -1381,6 +1395,8 @@ See `mode-line-percent-position'.")
(doom-modeline-def-segment input-method (doom-modeline-def-segment input-method
"The current input method." "The current input method."
(when (doom-modeline--active)
(propertize
(cond (cond
(current-input-method (current-input-method
(concat " " current-input-method-title " ")) (concat " " current-input-method-title " "))
@ -1388,18 +1404,8 @@ See `mode-line-percent-position'.")
(bound-and-true-p evil-input-method)) (bound-and-true-p evil-input-method))
(concat (concat
(nth 3 (assoc default-input-method input-method-alist)) (nth 3 (assoc default-input-method input-method-alist))
" ")))) " ")))
'face 'doom-modeline-buffer-major-mode)))
;;
;; remote host
;;
(doom-modeline-def-segment remote-host
"Hostname for remote buffers."
(when default-directory
(when-let ((host (file-remote-p default-directory 'host)))
(concat "@" host))))
;; ;;