emacs/lisp/init-ui.el 3.1 K raw
1
;;; init-ui.el -*- lexical-binding: t; -*-
2
3
(when (display-graphic-p)
4
  (set-face-attribute 'default nil :family "BerkeleyMono Nerd Font Mono" :height 130))
5
6
(use-package base16-theme)
7
8
(load-theme 'darkmatter t)
9
10
;;; Mode line
11
;; Evil's own indicator is dropped; the state is drawn by hand as a colored
12
;; square with the state letter. Icons are Nerd Font glyphs.
13
(setq evil-mode-line-format nil
14
      evil-echo-state nil)   ; no "-- INSERT --" in the echo area
15
(column-number-mode 1)
16
17
(defvar my/ml-states
18
  `((normal   "N" ,(alist-get 'base08 darkmatter-palette))
19
    (insert   "I" ,(alist-get 'base0A darkmatter-palette))
20
    (visual   "V" ,(alist-get 'base0B darkmatter-palette))
21
    (replace  "R" ,(alist-get 'red darkmatter-palette))
22
    (operator "O" ,(alist-get 'base0D darkmatter-palette))
23
    (motion   "M" ,(alist-get 'base0D darkmatter-palette))
24
    (emacs    "E" ,(alist-get 'base09 darkmatter-palette)))
25
  "Evil state -> (letter color) for the mode line.")
26
27
(defun my/ml-evil-state ()
28
  "Colored square with the current evil state letter."
29
  (when (bound-and-true-p evil-local-mode)
30
    (pcase-let ((`(,letter ,color) (or (alist-get evil-state my/ml-states)
31
                                       '("?" "#666666"))))
32
      (propertize (format " %s " letter)
33
                  'face `(:background ,color
34
                                      :foreground ,(alist-get 'base00 darkmatter-palette)
35
                                      :weight bold)))))
36
37
(setq-default
38
 mode-line-format
39
 '("%e"
40
   (:eval (my/ml-evil-state))
41
   "  "
42
   (:eval (when (and buffer-file-name (buffer-modified-p))
43
            (propertize "\uf111 " 'face '(:foreground "#e78a53"))))   ; nf-fa-circle
44
   (:propertize "%b" face mode-line-buffer-id)
45
   (:eval (when buffer-read-only "  \uf023"))                        ; nf-fa-lock
46
   "  "
47
   mode-name
48
   (:eval (when vc-mode
49
            (concat "  \ue0a0 "                                      ; branch
50
                    (string-trim (replace-regexp-in-string "^ *Git[-:]" "" vc-mode)))))
51
   mode-line-format-right-align
52
   ;; ERC / jabber activity ([#chan,...]) lives here
53
   (:eval (when (string-match-p "[^ ]" (format-mode-line global-mode-string))
54
            global-mode-string))
55
   "  %l:%c  %p "))
56
57
(setq initial-scratch-message
58
      " .              +   .                .   . .     .  .
59
                   .                    .       .     *
60
  .       *                        . . . .  .   .  + .
61
            \"You Are Here\"            .   .  +  . . .
62
.                 |             .  .   .    .    . .
63
                  |           .     .     . +.    +  .
64
                 \\|/            .       .   . .
65
        . .       V          .    * . . .  .  +   .
66
           +      .           .   .      +
67
                            .       . +  .+. .
68
  .                      .     . + .  . .     .      .
69
           .      .    .     . .   . . .        ! /
70
      *             .    . .  +    .  .       - O -
71
          .     .    .  +   . .  *  .       . / |
72
               . + .  .  .  .. +  .
73
.      .  .  .  *   .  *  . +..  .            *
74
 .      .   . .   .   .   . .  +   .    .            +
75
76
")
77
78
(provide 'init-ui)