From ec4e6b932e127b8a80e3cab4d0a87f40ad9c11e6 Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Sun, 19 May 2019 04:01:56 +0800 Subject: [PATCH] [Feature] overwrite-mode indicator. Close #174. --- README.md | 4 ++-- doom-modeline-segments.el | 24 +++++++++++++++++------- doom-modeline.el | 2 +- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index ae12e62..2001775 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ The `doom-modeline` was designed for minimalism, and offers: - A workspace number segment for `eyebrowse` - A perspective name segment for `persp-mode` - A window number segment for `ace-window`, `winum` and `window-numbering` -- An indicator for modal editing state, including `evil`, `god`, `ryo` and - `xah-fly-keys`, etc. +- An indicator for modal editing state, including `evil`, `overwrite`, `god`, + `ryo` and `xah-fly-keys`, etc. - An indicator for remote host - An indicator for debug state - An indicator for current input method diff --git a/doom-modeline-segments.el b/doom-modeline-segments.el index 4ee89c1..03cb581 100644 --- a/doom-modeline-segments.el +++ b/doom-modeline-segments.el @@ -1473,6 +1473,13 @@ mouse-1: Display Line and Column Mode Menu" ((evil-replace-state-p) 'doom-modeline-evil-replace-state)) 'mode-line-inactive))))) +(defsubst doom-modeline--overwrite () + "The current overwrite state. Requires `overwrite-mode' to be enabled." + (when (bound-and-true-p overwrite-mode) + (propertize " " 'face (if (doom-modeline--active) + 'doom-modeline-urgent + 'mode-line-inactive)))) + (defsubst doom-modeline--god () "The current god state. Requires `god-mode' to be enabled." (when (bound-and-true-p god-local-mode) @@ -1490,16 +1497,19 @@ mouse-1: Display Line and Column Mode Menu" (defsubst doom-modeline--xah-fly-keys () "The current `xah-fly-keys' state." (when (boundp 'xah-fly-insert-state-q) - (propertize (if xah-fly-insert-state-q - " " - " ") - 'face (if (doom-modeline--active) - 'doom-modeline-evil-normal-state - 'mode-line-inactive)))) + (let ((active (doom-modeline--active))) + (if xah-fly-insert-state-q + (propertize " " 'face (if active + 'doom-modeline-evil-insert-state + 'mode-line-inactive)) + (propertize " " 'face (if active + 'doom-modeline-evil-normal-state + 'mode-line-inactive)))))) (doom-modeline-def-segment modals - "Displays modal editing states, including `evil', `god', `ryo' and `xha-fly-kyes', etc. " + "Displays modal editing states, including `evil', `overwrite', `god', `ryo' and `xha-fly-kyes', etc." (concat (doom-modeline--evil) + (doom-modeline--overwrite) (doom-modeline--god) (doom-modeline--ryo) (doom-modeline--xah-fly-keys))) diff --git a/doom-modeline.el b/doom-modeline.el index 231bd92..3d9a9f2 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -45,7 +45,7 @@ ;; - A workspace number segment for eyebrowse ;; - A perspective name segment for persp-mode ;; - A window number segment for winum and window-numbering -;; - An indicator for modal editing state, including evil, god, ryo and +;; - An indicator for modal editing state, including evil, overwrite, god, ryo and ;; xah-fly-keys, etc. ;; - An indicator for remote host ;; - An indicator for current input method