Add mouse-over info to modeline segments
Also extracts indentation style info from +modeline-encoding into new +modeline-indent-style segment.
This commit is contained in:
parent
702e0a6159
commit
f20cfd21c2
1 changed files with 41 additions and 25 deletions
|
@ -439,19 +439,23 @@ Meant for `+modeline-buffer-path-function'."
|
||||||
:on-hooks (find-file-hook after-save-hook after-revert-hook)
|
:on-hooks (find-file-hook after-save-hook after-revert-hook)
|
||||||
:init (propertize "%b" 'face 'doom-modeline-buffer-file)
|
:init (propertize "%b" 'face 'doom-modeline-buffer-file)
|
||||||
:faces t
|
:faces t
|
||||||
(+modeline-build-path (buffer-file-name (buffer-base-buffer))))
|
(let ((file-path (buffer-file-name (buffer-base-buffer))))
|
||||||
|
(propertize (+modeline-build-path file-path)
|
||||||
|
'help-echo file-path)))
|
||||||
|
|
||||||
(def-modeline-segment! +modeline-buffer-directory
|
(def-modeline-segment! +modeline-buffer-directory
|
||||||
(let ((face (if (active) 'doom-modeline-buffer-path)))
|
(let ((face (if (active) 'doom-modeline-buffer-path)))
|
||||||
(concat (if (display-graphic-p) " ")
|
(propertize
|
||||||
(all-the-icons-octicon
|
(concat (if (display-graphic-p) " ")
|
||||||
"file-directory"
|
(all-the-icons-octicon
|
||||||
:face face
|
"file-directory"
|
||||||
:v-adjust -0.1
|
:face face
|
||||||
:height 1.25)
|
:v-adjust -0.1
|
||||||
" "
|
:height 1.25)
|
||||||
(propertize (abbreviate-file-name default-directory)
|
" "
|
||||||
'face face))))
|
(propertize (abbreviate-file-name default-directory)
|
||||||
|
'face face))
|
||||||
|
'help-echo default-directory)))
|
||||||
|
|
||||||
(def-modeline-segment! +modeline-vcs
|
(def-modeline-segment! +modeline-vcs
|
||||||
:on-set (vc-mode)
|
:on-set (vc-mode)
|
||||||
|
@ -486,25 +490,36 @@ Meant for `+modeline-buffer-path-function'."
|
||||||
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
(propertize (substring vc-mode (+ (if (eq backend 'Hg) 2 3) 2))
|
||||||
'face (if active face)))))))
|
'face (if active face)))))))
|
||||||
|
|
||||||
|
(def-modeline-segment! +modeline-indent-style
|
||||||
|
:on-hooks (after-revert-hook after-save-hook find-file-hook)
|
||||||
|
:on-set (indent-tabs-mode tab-width)
|
||||||
|
(propertize (format "%s%d "
|
||||||
|
(if indent-tabs-mode "⭾" "␣")
|
||||||
|
tab-width)
|
||||||
|
'help-echo
|
||||||
|
(format "Indentation: %d %s wide"
|
||||||
|
tab-width
|
||||||
|
(if indent-tabs-mode "tabs" "spaces"))))
|
||||||
|
|
||||||
(def-modeline-segment! +modeline-encoding
|
(def-modeline-segment! +modeline-encoding
|
||||||
:on-hooks (after-revert-hook after-save-hook find-file-hook)
|
:on-hooks (after-revert-hook after-save-hook find-file-hook)
|
||||||
:on-set (buffer-file-coding-system indent-tabs-mode tab-width)
|
:on-set (buffer-file-coding-system)
|
||||||
(format "%s%d %s %s"
|
(concat (pcase (coding-system-eol-type buffer-file-coding-system)
|
||||||
(if indent-tabs-mode "⭾" "␣")
|
(0 (propertize "LF" 'help-echo "EOL convention: \\n (Unix)"))
|
||||||
tab-width
|
(1 (propertize "CRLF" 'help-echo "EOL convention: \\r\\n (Windows, Symbian OS, etc)"))
|
||||||
(pcase (coding-system-eol-type buffer-file-coding-system)
|
(2 (propertize "CR" 'help-echo "EOL convention: \\r (pre-OSX MacOS)")))
|
||||||
(0 "LF")
|
" "
|
||||||
(1 "CRLF")
|
|
||||||
(2 "CR"))
|
|
||||||
(let* ((sys (coding-system-plist buffer-file-coding-system))
|
(let* ((sys (coding-system-plist buffer-file-coding-system))
|
||||||
(category (plist-get sys :category)))
|
(category (plist-get sys :category)))
|
||||||
(cond ((eq category 'coding-category-undecided)
|
(propertize
|
||||||
"")
|
(cond ((eq category 'coding-category-undecided)
|
||||||
((or (eq category 'coding-category-utf-8)
|
"")
|
||||||
(eq (plist-get sys :name) 'prefer-utf-8))
|
((or (eq category 'coding-category-utf-8)
|
||||||
"UTF-8 ")
|
(eq (plist-get sys :name) 'prefer-utf-8))
|
||||||
((concat (upcase (symbol-name (plist-get sys :name)))
|
"UTF-8 ")
|
||||||
" "))))))
|
((concat (upcase (symbol-name (plist-get sys :name)))
|
||||||
|
" ")))
|
||||||
|
'help-echo (plist-get (coding-system-plist buffer-file-coding-system) :docstring)))))
|
||||||
|
|
||||||
(def-modeline-segment! +modeline-major-mode
|
(def-modeline-segment! +modeline-major-mode
|
||||||
(propertize (format-mode-line mode-name)
|
(propertize (format-mode-line mode-name)
|
||||||
|
@ -680,6 +695,7 @@ icons."
|
||||||
+modeline-buffer-id
|
+modeline-buffer-id
|
||||||
" %2l:%c %p ")
|
" %2l:%c %p ")
|
||||||
`(mode-line-misc-info
|
`(mode-line-misc-info
|
||||||
|
+modeline-indent-style
|
||||||
+modeline-encoding
|
+modeline-encoding
|
||||||
+modeline-major-mode " "
|
+modeline-major-mode " "
|
||||||
(vc-mode (" " +modeline-vcs " "))
|
(vc-mode (" " +modeline-vcs " "))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue