Fix #59: [Feature] Minor modes segment. Disable by default.

This commit is contained in:
Vincent Zhang 2018-12-05 03:39:07 +08:00
parent e43da4a963
commit c0b5f1c0ab
2 changed files with 29 additions and 4 deletions

View file

@ -98,6 +98,9 @@ Strongly recommend to use
;; Whether show the icon for major mode. It should respect `doom-modeline-icon'. ;; Whether show the icon for major mode. It should respect `doom-modeline-icon'.
(setq doom-modeline-major-mode-icon t) (setq doom-modeline-major-mode-icon t)
;; Whether display minor modes or not. Non-nil to display in mode-line.
(setq doom-modeline-minor-modes nil)
``` ```
## FAQ ## FAQ

View file

@ -109,6 +109,9 @@ The icons may not be showed correctly in terminal and on Windows.")
(defvar doom-modeline-major-mode-icon t (defvar doom-modeline-major-mode-icon t
"Whether show the icon for major mode. It should respect `doom-modeline-icon'.") "Whether show the icon for major mode. It should respect `doom-modeline-icon'.")
(defvar doom-modeline-minor-modes nil
"Whether display minor modes or not. Non-nil to display in mode-line.")
;; ;;
;; compatibility ;; compatibility
@ -1272,6 +1275,25 @@ 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
;; ;;
@ -1279,7 +1301,7 @@ Requires `eyebrowse-mode' to be enabled."
(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 (< 0 (length global-mode-string))
'(" " global-mode-string " ") '("" global-mode-string " ")
"")) ""))
@ -1361,12 +1383,12 @@ See `mode-line-percent-position'.")
"The current input method." "The current input method."
(cond (cond
(current-input-method (current-input-method
(concat current-input-method-title " ")) (concat " " current-input-method-title " "))
((and (bound-and-true-p evil-local-mode) ((and (bound-and-true-p evil-local-mode)
(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))
" ")))) " "))))
;; ;;
@ -1386,7 +1408,7 @@ See `mode-line-percent-position'.")
(doom-modeline-def-modeline 'main (doom-modeline-def-modeline 'main
'(bar workspace-number window-number evil-state god-state ryo-modal-state matches " " buffer-info remote-host buffer-position " " selection-info) '(bar workspace-number window-number evil-state god-state ryo-modal-state matches " " buffer-info remote-host buffer-position " " selection-info)
'(global persp-name input-method buffer-encoding major-mode process vcs flycheck)) '(global persp-name minor-modes input-method buffer-encoding major-mode process vcs flycheck))
(doom-modeline-def-modeline 'minimal (doom-modeline-def-modeline 'minimal
'(bar matches " " buffer-info) '(bar matches " " buffer-info)