Display buffer state in buffer-default-directory segment.

See #368.
This commit is contained in:
Vincent Zhang 2020-07-23 16:45:16 +08:00
parent d7f187efc6
commit e27473dd23

View file

@ -225,20 +225,6 @@
;; Buffer information ;; Buffer information
;; ;;
(doom-modeline-def-segment buffer-default-directory
"Displays `default-directory'. This is for special buffers like the scratch
buffer where knowing the current project directory is important."
(let* ((active (doom-modeline--active))
(face (if active 'doom-modeline-buffer-path 'mode-line-inactive)))
(concat (doom-modeline-spc)
(and doom-modeline-major-mode-icon
(concat (doom-modeline-icon
'octicon "file-directory" "🖿" ""
:face face :v-adjust -0.05 :height 1.25)
(doom-modeline-vspc)))
(propertize (abbreviate-file-name default-directory) 'face face))))
;;
(defvar-local doom-modeline--buffer-file-icon nil) (defvar-local doom-modeline--buffer-file-icon nil)
(defun doom-modeline-update-buffer-file-icon (&rest _) (defun doom-modeline-update-buffer-file-icon (&rest _)
"Update file icon in mode-line." "Update file icon in mode-line."
@ -421,6 +407,20 @@ directory, the file name, and its state (modified, read-only or non-existent)."
mouse-1: Previous buffer\nmouse-3: Next buffer" mouse-1: Previous buffer\nmouse-3: Next buffer"
'local-map mode-line-buffer-identification-keymap))) 'local-map mode-line-buffer-identification-keymap)))
(doom-modeline-def-segment buffer-default-directory
"Displays `default-directory'. This is for special buffers like the scratch
buffer where knowing the current project directory is important."
(let* ((active (doom-modeline--active))
(face (if active 'doom-modeline-buffer-path 'mode-line-inactive)))
(concat (doom-modeline-spc)
(doom-modeline--buffer-state-icon)
(and doom-modeline-major-mode-icon
(concat (doom-modeline-icon
'octicon "file-directory" "🖿" ""
:face face :v-adjust -0.05 :height 1.25)
(doom-modeline-vspc)))
(propertize (abbreviate-file-name default-directory) 'face face))))
;; ;;
;; Encoding ;; Encoding