mirror of
https://github.com/vale981/doom-modeline
synced 2025-03-05 09:21:38 -05:00
[Feature] Support evil state icon.
New option: doom-modeline-evil-state-icon. The fallback is the unicode character. Update evil state faces.
This commit is contained in:
parent
44d0f7b871
commit
e93660e93f
3 changed files with 90 additions and 78 deletions
21
README.md
21
README.md
|
@ -208,16 +208,16 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables.
|
||||||
;; Whether to use unicode as a fallback (instead of ASCII) when not using icons.
|
;; Whether to use unicode as a fallback (instead of ASCII) when not using icons.
|
||||||
(setq doom-modeline-unicode-fallback t)
|
(setq doom-modeline-unicode-fallback t)
|
||||||
|
|
||||||
;; Whether display minor modes in mode-line.
|
;; Whether display the minor modes in mode-line.
|
||||||
(setq doom-modeline-minor-modes (featurep 'minions))
|
(setq doom-modeline-minor-modes (featurep 'minions))
|
||||||
|
|
||||||
;; If non-nil, a word count will be added to the selection-info modeline segment.
|
;; If non-nil, a word count will be added to the selection-info modeline segment.
|
||||||
(setq doom-modeline-enable-word-count nil)
|
(setq doom-modeline-enable-word-count nil)
|
||||||
|
|
||||||
;; Whether display buffer encoding.
|
;; Whether display the buffer encoding.
|
||||||
(setq doom-modeline-buffer-encoding t)
|
(setq doom-modeline-buffer-encoding t)
|
||||||
|
|
||||||
;; Whether display indentation information.
|
;; Whether display the indentation information.
|
||||||
(setq doom-modeline-indent-info nil)
|
(setq doom-modeline-indent-info nil)
|
||||||
|
|
||||||
;; If non-nil, only display one number for checker information if applicable.
|
;; If non-nil, only display one number for checker information if applicable.
|
||||||
|
@ -229,28 +229,31 @@ Run `M-x customize-group RET doom-modeline RET` or set the variables.
|
||||||
;; The maximum displayed length of the branch name of version control.
|
;; The maximum displayed length of the branch name of version control.
|
||||||
(setq doom-modeline-vcs-max-length 12)
|
(setq doom-modeline-vcs-max-length 12)
|
||||||
|
|
||||||
;; Whether display perspective name. Non-nil to display in mode-line.
|
;; Whether display the perspective name. Non-nil to display in mode-line.
|
||||||
(setq doom-modeline-persp-name t)
|
(setq doom-modeline-persp-name t)
|
||||||
|
|
||||||
;; Whether display `lsp' state. Non-nil to display in mode-line.
|
;; Whether display the `lsp' state. Non-nil to display in mode-line.
|
||||||
(setq doom-modeline-lsp t)
|
(setq doom-modeline-lsp t)
|
||||||
|
|
||||||
;; Whether display GitHub notifications. It requires `ghub` package.
|
;; Whether display the GitHub notifications. It requires `ghub` package.
|
||||||
(setq doom-modeline-github nil)
|
(setq doom-modeline-github nil)
|
||||||
|
|
||||||
;; The interval of checking GitHub.
|
;; The interval of checking GitHub.
|
||||||
(setq doom-modeline-github-interval (* 30 60))
|
(setq doom-modeline-github-interval (* 30 60))
|
||||||
|
|
||||||
;; Whether display mu4e notifications. It requires `mu4e-alert' package.
|
;; Whether display the `evil' state icon.
|
||||||
|
(setq doom-modeline-evil-state-icon t)
|
||||||
|
|
||||||
|
;; Whether display the mu4e notifications. It requires `mu4e-alert' package.
|
||||||
(setq doom-modeline-mu4e t)
|
(setq doom-modeline-mu4e t)
|
||||||
|
|
||||||
;; Whether display irc notifications. It requires `circe' package.
|
;; Whether display the irc notifications. It requires `circe' package.
|
||||||
(setq doom-modeline-irc t)
|
(setq doom-modeline-irc t)
|
||||||
|
|
||||||
;; Function to stylize the irc buffer names.
|
;; Function to stylize the irc buffer names.
|
||||||
(setq doom-modeline-irc-stylize 'identity)
|
(setq doom-modeline-irc-stylize 'identity)
|
||||||
|
|
||||||
;; Whether display environment version.
|
;; Whether display the environment version.
|
||||||
(setq doom-modeline-env-version t)
|
(setq doom-modeline-env-version t)
|
||||||
;; Or for individual languages
|
;; Or for individual languages
|
||||||
(setq doom-modeline-env-enable-python t)
|
(setq doom-modeline-env-enable-python t)
|
||||||
|
|
|
@ -198,7 +198,7 @@ Specify another one if you encounter the issue."
|
||||||
:group'doom-modeline)
|
:group'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-icon (display-graphic-p)
|
(defcustom doom-modeline-icon (display-graphic-p)
|
||||||
"Whether display icons in mode-line.
|
"Whether display the icons in mode-line.
|
||||||
|
|
||||||
It respects `all-the-icons-color-icons'.
|
It respects `all-the-icons-color-icons'.
|
||||||
While using the server mode in GUI, should set the value explicitly."
|
While using the server mode in GUI, should set the value explicitly."
|
||||||
|
@ -239,7 +239,7 @@ It respects `doom-modeline-icon' and `doom-modeline-buffer-state-icon'."
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-minor-modes (featurep 'minions)
|
(defcustom doom-modeline-minor-modes (featurep 'minions)
|
||||||
"Whether display minor modes in mode-line."
|
"Whether display the minor modes in mode-line."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
|
@ -249,12 +249,12 @@ It respects `doom-modeline-icon' and `doom-modeline-buffer-state-icon'."
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-buffer-encoding t
|
(defcustom doom-modeline-buffer-encoding t
|
||||||
"Whether display buffer encoding."
|
"Whether display the buffer encoding."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-indent-info nil
|
(defcustom doom-modeline-indent-info nil
|
||||||
"Whether display indentation information."
|
"Whether display the indentation information."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
|
@ -274,21 +274,21 @@ It respects `doom-modeline-icon' and `doom-modeline-buffer-state-icon'."
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-persp-name t
|
(defcustom doom-modeline-persp-name t
|
||||||
"Whether display perspective name.
|
"Whether display the perspective name.
|
||||||
|
|
||||||
Non-nil to display in mode-line."
|
Non-nil to display in mode-line."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-lsp t
|
(defcustom doom-modeline-lsp t
|
||||||
"Whether display `lsp' state.
|
"Whether display the `lsp' state.
|
||||||
|
|
||||||
Non-nil to display in mode-line."
|
Non-nil to display in mode-line."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-github nil
|
(defcustom doom-modeline-github nil
|
||||||
"Whether display GitHub notifications/
|
"Whether display the GitHub notifications.
|
||||||
|
|
||||||
It requires `ghub' and `async' packages."
|
It requires `ghub' and `async' packages."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
|
@ -300,19 +300,24 @@ It requires `ghub' and `async' packages."
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-env-version t
|
(defcustom doom-modeline-env-version t
|
||||||
"Whether display environment version."
|
"Whether display the environment version."
|
||||||
|
:type 'boolean
|
||||||
|
:group 'doom-modeline)
|
||||||
|
|
||||||
|
(defcustom doom-modeline-evil-state-icon t
|
||||||
|
"Whether display the `evil' state icon."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-mu4e t
|
(defcustom doom-modeline-mu4e t
|
||||||
"Whether display mu4e notifications.
|
"Whether display the mu4e notifications.
|
||||||
|
|
||||||
It requires `mu4e-alert' package."
|
It requires `mu4e-alert' package."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
:group 'doom-modeline)
|
:group 'doom-modeline)
|
||||||
|
|
||||||
(defcustom doom-modeline-irc t
|
(defcustom doom-modeline-irc t
|
||||||
"Whether display irc notifications.
|
"Whether display the irc notifications.
|
||||||
|
|
||||||
It requires `circe' package."
|
It requires `circe' package."
|
||||||
:type 'boolean
|
:type 'boolean
|
||||||
|
@ -420,7 +425,7 @@ It requires `circe' package."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
(defface doom-modeline-evil-emacs-state
|
(defface doom-modeline-evil-emacs-state
|
||||||
'((t (:inherit doom-modeline-warning)))
|
'((t (:inherit (doom-modeline-highlight bold))))
|
||||||
"Face for the Emacs state tag in evil state indicator."
|
"Face for the Emacs state tag in evil state indicator."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
|
@ -430,7 +435,7 @@ It requires `circe' package."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
(defface doom-modeline-evil-motion-state
|
(defface doom-modeline-evil-motion-state
|
||||||
'((t :inherit doom-modeline-buffer-path))
|
'((t :inherit doom-modeline-buffer-file))
|
||||||
"Face for the motion state tag in evil state indicator."
|
"Face for the motion state tag in evil state indicator."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
|
@ -440,12 +445,12 @@ It requires `circe' package."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
(defface doom-modeline-evil-operator-state
|
(defface doom-modeline-evil-operator-state
|
||||||
'((t (:inherit doom-modeline-buffer-path)))
|
'((t (:inherit doom-modeline-buffer-file)))
|
||||||
"Face for the operator state tag in evil state indicator."
|
"Face for the operator state tag in evil state indicator."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
(defface doom-modeline-evil-visual-state
|
(defface doom-modeline-evil-visual-state
|
||||||
'((t (:inherit doom-modeline-buffer-file)))
|
'((t (:inherit doom-modeline-warning)))
|
||||||
"Face for the visual state tag in evil state indicator."
|
"Face for the visual state tag in evil state indicator."
|
||||||
:group 'doom-modeline-faces)
|
:group 'doom-modeline-faces)
|
||||||
|
|
||||||
|
|
|
@ -1513,8 +1513,13 @@ mouse-1: Display Line and Column Mode Menu"
|
||||||
(defsubst doom-modeline--evil ()
|
(defsubst doom-modeline--evil ()
|
||||||
"The current evil state. Requires `evil-mode' to be enabled."
|
"The current evil state. Requires `evil-mode' to be enabled."
|
||||||
(when (bound-and-true-p evil-local-mode)
|
(when (bound-and-true-p evil-local-mode)
|
||||||
(let ((tag (evil-state-property evil-state :tag t)))
|
(propertize (concat
|
||||||
(propertize tag 'face
|
(doom-modeline-spc)
|
||||||
|
(doom-modeline-icon
|
||||||
|
'material
|
||||||
|
(when doom-modeline-evil-state-icon "fiber_manual_record")
|
||||||
|
"●"
|
||||||
|
(string-trim (evil-state-property evil-state :tag t))
|
||||||
(if (doom-modeline--active)
|
(if (doom-modeline--active)
|
||||||
(cond ((evil-normal-state-p) 'doom-modeline-evil-normal-state)
|
(cond ((evil-normal-state-p) 'doom-modeline-evil-normal-state)
|
||||||
((evil-emacs-state-p) 'doom-modeline-evil-emacs-state)
|
((evil-emacs-state-p) 'doom-modeline-evil-emacs-state)
|
||||||
|
@ -1522,8 +1527,12 @@ mouse-1: Display Line and Column Mode Menu"
|
||||||
((evil-motion-state-p) 'doom-modeline-evil-motion-state)
|
((evil-motion-state-p) 'doom-modeline-evil-motion-state)
|
||||||
((evil-visual-state-p) 'doom-modeline-evil-visual-state)
|
((evil-visual-state-p) 'doom-modeline-evil-visual-state)
|
||||||
((evil-operator-state-p) 'doom-modeline-evil-operator-state)
|
((evil-operator-state-p) 'doom-modeline-evil-operator-state)
|
||||||
((evil-replace-state-p) 'doom-modeline-evil-replace-state))
|
((evil-replace-state-p) 'doom-modeline-evil-replace-state)
|
||||||
'mode-line-inactive)))))
|
(t 'mode-line))
|
||||||
|
'mode-line-inactive)
|
||||||
|
:v-adjust -0.225)
|
||||||
|
(doom-modeline-spc))
|
||||||
|
'help-echo (evil-state-property evil-state :name t))))
|
||||||
|
|
||||||
(defsubst doom-modeline--overwrite ()
|
(defsubst doom-modeline--overwrite ()
|
||||||
"The current overwrite state. Requires `overwrite-mode' to be enabled."
|
"The current overwrite state. Requires `overwrite-mode' to be enabled."
|
||||||
|
@ -1584,14 +1593,13 @@ mouse-1: Display Line and Column Mode Menu"
|
||||||
"The current objed state."
|
"The current objed state."
|
||||||
(when (and doom-modeline--objed-active
|
(when (and doom-modeline--objed-active
|
||||||
(doom-modeline--active))
|
(doom-modeline--active))
|
||||||
(propertize
|
(propertize (format " %s(%s) "
|
||||||
(format " %s(%s) "
|
|
||||||
(symbol-name objed--object)
|
|
||||||
(char-to-string (aref (symbol-name objed--obj-state) 0)))
|
|
||||||
'face 'doom-modeline-evil-emacs-state
|
|
||||||
'help-echo (format "Objed object: %s (%s)"
|
|
||||||
(symbol-name objed--object)
|
(symbol-name objed--object)
|
||||||
(symbol-name objed--obj-state)))))
|
(char-to-string (aref (symbol-name objed--obj-state) 0)))
|
||||||
|
'face 'doom-modeline-evil-emacs-state
|
||||||
|
'help-echo (format "Objed object: %s (%s)"
|
||||||
|
(symbol-name objed--object)
|
||||||
|
(symbol-name objed--obj-state)))))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -1600,30 +1608,28 @@ mouse-1: Display Line and Column Mode Menu"
|
||||||
|
|
||||||
(doom-modeline-def-segment input-method
|
(doom-modeline-def-segment input-method
|
||||||
"The current input method."
|
"The current input method."
|
||||||
(propertize
|
(propertize (cond (current-input-method
|
||||||
(cond
|
(concat (doom-modeline-spc)
|
||||||
(current-input-method
|
current-input-method-title
|
||||||
(concat (doom-modeline-spc)
|
(doom-modeline-spc)))
|
||||||
current-input-method-title
|
((and (bound-and-true-p evil-local-mode)
|
||||||
(doom-modeline-spc)))
|
(bound-and-true-p evil-input-method))
|
||||||
((and (bound-and-true-p evil-local-mode)
|
(concat
|
||||||
(bound-and-true-p evil-input-method))
|
(doom-modeline-spc)
|
||||||
(concat
|
(nth 3 (assoc default-input-method input-method-alist))
|
||||||
(doom-modeline-spc)
|
(doom-modeline-spc)))
|
||||||
(nth 3 (assoc default-input-method input-method-alist))
|
(t ""))
|
||||||
(doom-modeline-spc)))
|
'face (if (doom-modeline--active)
|
||||||
(t ""))
|
'doom-modeline-buffer-major-mode
|
||||||
'face (if (doom-modeline--active)
|
'mode-line-inactive)
|
||||||
'doom-modeline-buffer-major-mode
|
'help-echo (concat
|
||||||
'mode-line-inactive)
|
"Current input method: "
|
||||||
'help-echo (concat
|
current-input-method
|
||||||
"Current input method: "
|
"\n\
|
||||||
current-input-method
|
|
||||||
"\n\
|
|
||||||
mouse-2: Disable input method\n\
|
mouse-2: Disable input method\n\
|
||||||
mouse-3: Describe current input method")
|
mouse-3: Describe current input method")
|
||||||
'mouse-face 'mode-line-highlight
|
'mouse-face 'mode-line-highlight
|
||||||
'local-map mode-line-input-method-map))
|
'local-map mode-line-input-method-map))
|
||||||
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -1718,12 +1724,11 @@ mouse-1: Reload to start server")
|
||||||
(jsonrpc--request-continuations server))))
|
(jsonrpc--request-continuations server))))
|
||||||
(`(,_id ,doing ,done-p ,detail) (and server (eglot--spinner server)))
|
(`(,_id ,doing ,done-p ,detail) (and server (eglot--spinner server)))
|
||||||
(last-error (and server (jsonrpc-last-error server)))
|
(last-error (and server (jsonrpc-last-error server)))
|
||||||
(face (cond
|
(face (cond (last-error 'doom-modeline-lsp-error)
|
||||||
(last-error 'doom-modeline-lsp-error)
|
((and doing (not done-p)) 'compilation-mode-line-run)
|
||||||
((and doing (not done-p)) 'compilation-mode-line-run)
|
((and pending (cl-plusp pending)) 'doom-modeline-lsp-warning)
|
||||||
((and pending (cl-plusp pending)) 'doom-modeline-lsp-warning)
|
(nick 'doom-modeline-lsp-success)
|
||||||
(nick 'doom-modeline-lsp-success)
|
(t 'mode-line)))
|
||||||
(t 'mode-line)))
|
|
||||||
(icon (doom-modeline-lsp-icon "EGLOT" face)))
|
(icon (doom-modeline-lsp-icon "EGLOT" face)))
|
||||||
(propertize icon
|
(propertize icon
|
||||||
'help-echo (cond
|
'help-echo (cond
|
||||||
|
@ -1743,22 +1748,21 @@ mouse-3: Reconnect to server" nick (eglot--major-mode server)))
|
||||||
(t "EGLOT Disconnected"))
|
(t "EGLOT Disconnected"))
|
||||||
'mouse-face '(:box 0)
|
'mouse-face '(:box 0)
|
||||||
'local-map (let ((map (make-sparse-keymap)))
|
'local-map (let ((map (make-sparse-keymap)))
|
||||||
(cond
|
(cond (last-error
|
||||||
(last-error
|
(define-key map [mode-line mouse-3]
|
||||||
(define-key map [mode-line mouse-3]
|
#'eglot-clear-status))
|
||||||
#'eglot-clear-status))
|
((and pending (cl-plusp pending))
|
||||||
((and pending (cl-plusp pending))
|
(define-key map [mode-line mouse-3]
|
||||||
(define-key map [mode-line mouse-3]
|
#'eglot-forget-pending-continuations))
|
||||||
#'eglot-forget-pending-continuations))
|
(nick
|
||||||
(nick
|
(define-key map [mode-line C-mouse-1]
|
||||||
(define-key map [mode-line C-mouse-1]
|
#'eglot-stderr-buffer)
|
||||||
#'eglot-stderr-buffer)
|
(define-key map [mode-line mouse-1]
|
||||||
(define-key map [mode-line mouse-1]
|
#'eglot-events-buffer)
|
||||||
#'eglot-events-buffer)
|
(define-key map [mode-line mouse-2]
|
||||||
(define-key map [mode-line mouse-2]
|
#'eglot-shutdown)
|
||||||
#'eglot-shutdown)
|
(define-key map [mode-line mouse-3]
|
||||||
(define-key map [mode-line mouse-3]
|
#'eglot-reconnect)))
|
||||||
#'eglot-reconnect)))
|
|
||||||
map)))))
|
map)))))
|
||||||
(add-hook 'eglot--managed-mode-hook #'doom-modeline-update-eglot)
|
(add-hook 'eglot--managed-mode-hook #'doom-modeline-update-eglot)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue