From 83731bca00c72e72e9de137d0290817dc2d0c2ba Mon Sep 17 00:00:00 2001 From: Vincent Zhang Date: Fri, 7 Dec 2018 00:24:29 +0800 Subject: [PATCH] Add two enablers for persp-name and lsp segments. See https://github.com/seagle0128/doom-modeline/issues/59#issuecomment-444842483. --- README.md | 6 ++++++ doom-modeline.el | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 75e5a7c..7ce27cc 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,12 @@ Strongly recommend to use ;; Whether display minor modes or not. Non-nil to display in mode-line. (setq doom-modeline-minor-modes nil) + +;; Whether display perspective name or not. Non-nil to display in mode-line. +(setq doom-modeline-persp-name t) + +;; Whether display `lsp' state or not. Non-nil to display in mode-line. +(setq doom-modeline-lsp t) ``` ## FAQ diff --git a/doom-modeline.el b/doom-modeline.el index d8e235d..7051886 100644 --- a/doom-modeline.el +++ b/doom-modeline.el @@ -114,6 +114,12 @@ The icons may not be showed correctly in terminal and on Windows.") (defvar doom-modeline-minor-modes nil "Whether display minor modes or not. Non-nil to display in mode-line.") +(defvar doom-modeline-persp-name t + "Whether display perspective name or not. Non-nil to display in mode-line.") + +(defvar doom-modeline-lsp t + "Whether display `lsp' state or not. Non-nil to display in mode-line.") + ;; ;; compatibility @@ -1298,7 +1304,8 @@ Requires `eyebrowse-mode' to be enabled." "Update perspective name in mode-line." (setq doom-modeline--persp-name ;; Support `persp-mode', while not support `perspective' - (when (and (bound-and-true-p persp-mode) + (when (and doom-modeline-persp-name + (bound-and-true-p persp-mode) (fboundp 'safe-persp-name) (fboundp 'get-current-persp)) (let ((persp (get-current-persp))) @@ -1454,7 +1461,8 @@ mouse-1: Display Line and Column Mode Menu" (doom-modeline-def-segment lsp "The LSP server state." - (if (and (doom-modeline--active) + (if (and doom-modeline-lsp + (doom-modeline--active) (bound-and-true-p lsp-mode)) (concat (lsp-mode-line) " ")))