-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-mode-line.el
104 lines (88 loc) · 3.08 KB
/
setup-mode-line.el
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Sets up a custom mode line
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when (fboundp 'csv-mode)
(message "trying to set up the mode line with csv mode"
;; TODO
))
(defun mode-line-fill (face reserve)
"Return empty space using FACE and leaving RESERVE space on the right."
(unless reserve
(setq reserve 20))
(when (and window-system (eq 'right (get-scroll-bar-mode)))
(setq reserve (- reserve 3)))
(propertize " "
'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve)))
'face face))
(use-package nyan-mode
:ensure nyan-mode
:config
(setq nyan-bar-length 18
nyan-wavy-trail nil))
(defface evil-modeline-emacs-face
'((t (:background "#333399"
:foreground "#cc99ff"
:weight bold)))
"Mode line face for insert and emacs states in evil.")
(defface evil-modeline-normal-face
'((t (:background "#111111"
:foreground "#dfaf8f"
:weight bold)))
"Mode line face for normal state in evil.")
(defface evil-modeline-visual-face
'((t (:background "#660033"
:foreground "#3399ff"
:weight bold)))
"Mode line face for visual state in evil.")
(defvar de/mode-line-evil
'(:eval
(let ((evil-modeline-indicator-face
(cl-case evil-state
(emacs 'evil-modeline-emacs-face)
(insert 'evil-modeline-emacs-face)
(normal 'evil-modeline-normal-face)
(visual 'evil-modeline-visual-face))))
(propertize evil-mode-line-tag
'face evil-modeline-indicator-face)))
"Display the evil state in the mode line.")
(defvar de/mode-line-buffer-name
'(:eval
(concat
;; (if (and (not (eq major-mode 'dired-mode)) buffer-file-name)
;; (propertize default-directory
;; 'face '(:height 130)))
(propertize "%b"
'face 'font-lock-keyword-face)
(propertize (concat "" (if (and (buffer-file-name) (buffer-modified-p)) "[*]" " "))
'face '(:height 130))))
"Display the buffer name, with trailing \"[*]\" if modified from disk.")
(defvar de/mode-line-buffer-size
'(:eval (concat (propertize "[ %l | %c ] "
'face '(:height 130))))
"Display the line number")
(defvar de/mode-line-mode-info
'(:eval (propertize "%m"
'face 'font-lock-variable-name-face))
"Display the major mode")
(setq de/mode-line-time
'(:eval
(propertize (format-time-string " %a, %m/%d %I:%M%p")
'face '(:height 130 :foreground "LightSkyBlue"))))
(setq-default mode-line-format
(list ""
de/mode-line-evil
"%@ " ;; '-' if default-directory is local, '@' if it's remote
de/mode-line-buffer-name
de/mode-line-buffer-size
;; mode-line-position
'(:eval (nyan-create))
de/mode-line-mode-info " "
de/mode-line-time))
(defun flash-mode-line ()
"Flash the mode line white briefly."
(let ((bg (face-background 'mode-line)))
(set-face-background 'mode-line "white")
(run-with-idle-timer 0.1 nil #'set-face-background 'mode-line bg)))
;; (face-background 'minibuffer)
(setq ring-bell-function #'flash-mode-line)
(provide 'setup-mode-line)