blob: 0b142d69627d723f448f33c39c1f8e4e4df8b23e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
;;;; remove all the stupid stupid stupid crap
(define-minor-mode minor-mode-blackout-mode
"Hides minor modes from the mode line."
t)
(catch 'done
(mapc (lambda (x)
(when (and (consp x)
(equal (cadr x) '("" minor-mode-alist)))
(let ((original (copy-sequence x)))
(setcar x 'minor-mode-blackout-mode)
(setcdr x (list "" original)))
(throw 'done t)))
mode-line-modes))
(global-set-key (kbd "C-c ,") 'minor-mode-blackout-mode)
(defface bd/underline-shadow
`((t :inherit shadow
:underline t))
"Shadow with an underline.")
(defvar-local bd/buffer-identification-mode-line
'(:eval (format "%s " (propertize (buffer-name) 'face 'bd/underline-shadow)))
"Formats the modeline-buffer-name.")
(defvar-local bd/modeline-buffer-file-state-icon
'(:eval
(cond (buffer-read-only
(propertize " L " 'face `(:foreground ,(ef-themes-get-color-value 'warning))))
((and buffer-file-name (buffer-modified-p))
(propertize " S " 'face `(:foreground ,(ef-themes-get-color-value 'warning))))
((and buffer-file-name
;; Avoid freezing while connection is lost
(not (file-remote-p buffer-file-name))
(not (file-exists-p buffer-file-name)))
(propertize " ? " 'face `(:foreground ,(ef-themes-get-color-value 'err))))
(t "")))
"Formats the file modification status.")
;;;; pos
(column-number-mode)
(setopt mode-line-position-column-line-format '(" %l:%c "))
(defvar-local bd/line-position
'(:eval
(when (mode-line-window-selected-p)
;; remove the percentage
(cdr mode-line-position))))
;;;; git
(defun git-vc-modeline ()
(mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-"))
(defvar-local bd/vc-mode-line
'(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; fix to avoid bug which occurs in magit buffer (don't remember)
(format " %s "
(propertize (git-vc-modeline) 'face 'shadow))))
"Formats the checked out git repository.")
(dolist (construct '(bd/time-mode-line
bd/buffer-identification-mode-line
bd/vc-mode-line
bd/line-position))
(put construct 'risky-local-variable t))
(setq-default mode-line-format
(list
mode-line-front-space
bd/buffer-identification-mode-line
mode-line-modes
bd/modeline-buffer-file-state-icon
bd/vc-mode-line
bd/line-position))
(provide 'bd--modeline)
;;; bd-modeline ends here
|