-
Notifications
You must be signed in to change notification settings - Fork 10
/
treemacs-nerd-icons.el
144 lines (128 loc) · 11.7 KB
/
treemacs-nerd-icons.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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
;;; treemacs-nerd-icons.el --- Emacs Nerd Font Icons theme for treemacs -*- lexical-binding: t -*-
;; Copyright (C) 2023 Hongyu Ding <[email protected]>
;; Author: Hongyu Ding <[email protected]>
;; Keywords: lisp
;; Version: 0.0.1
;; Package-Requires: ((emacs "24.3") (nerd-icons "0.0.1") (treemacs "0.0"))
;; URL: https://github.com/rainstormstudio/treemacs-nerd-icons
;; Keywords: files, icons, treemacs
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; nerd-icons theme for treemacs
;;; Code:
(require 'nerd-icons)
(require 'treemacs)
(defface treemacs-nerd-icons-root-face
'((t (:inherit nerd-icons-dorange)))
"Face used for the root icon in nerd-icons theme."
:group 'treemacs-faces)
(defface treemacs-nerd-icons-file-face
'((t (:inherit nerd-icons-orange)))
"Face used for the directory and file icons in nerd-icons theme."
:group 'treemacs-faces)
(defvar treemacs-nerd-icons-tab (propertize "\t" :face 'treemacs-nerd-icons-file-face))
(treemacs-create-theme "nerd-icons"
:config
(progn
(dolist (item nerd-icons-extension-icon-alist)
(let* ((extension (car item))
(func (cadr item))
(args (append (list (cadr (cdr item))) '(:v-adjust -0.05 :height 1.0) (cdr (cddr item))))
(icon (apply func args)))
(let* ((icon-pair (cons (format " %s%s%s" treemacs-nerd-icons-tab icon treemacs-nerd-icons-tab) (format " %s%s%s" treemacs-nerd-icons-tab icon treemacs-nerd-icons-tab)))
(gui-icons (treemacs-theme->gui-icons treemacs--current-theme))
(tui-icons (treemacs-theme->tui-icons treemacs--current-theme))
(gui-icon (car icon-pair))
(tui-icon (cdr icon-pair)))
(ht-set! gui-icons extension gui-icon)
(ht-set! tui-icons extension tui-icon))))
;; directory and other icons
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-repo" :face 'treemacs-nerd-icons-root-face) treemacs-nerd-icons-tab)
:extensions (root-closed root-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_down" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder_open" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (dir-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_right" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (dir-closed)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_down" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder_open" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (src-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_right" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (src-closed)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_down" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder_open" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (build-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_right" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (build-closed)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_down" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder_open" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (test-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_right" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-folder" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (test-closed)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_down" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-octicon "nf-oct-package" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (tag-open)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s%s%s" (nerd-icons-octicon "nf-oct-chevron_right" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab (nerd-icons-octicon "nf-oct-package" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (tag-closed)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-tag" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (tag-leaf)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-flame" :face 'nerd-icons-red) treemacs-nerd-icons-tab)
:extensions (error)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-stop" :face 'nerd-icons-yellow) treemacs-nerd-icons-tab)
:extensions (warning)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-info" :face 'nerd-icons-blue) treemacs-nerd-icons-tab)
:extensions (info)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-mdicon "nf-md-mail" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (mail)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-bookmark" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (bookmark)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-mdicon "nf-md-monitor" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (screen)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-mdicon "nf-md-home" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (house)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-faicon "nf-fa-list" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (list)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-mdicon "nf-md-repeat" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (repeat)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-faicon "nf-fa-suitcase" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (suitcase)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-mdicon "nf-md-close" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (close)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-octicon "nf-oct-calendar" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (calendar)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format "%s%s" (nerd-icons-faicon "nf-fa-briefcase" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (briefcase)
:fallback 'same-as-icon)
(treemacs-create-icon :icon (format " %s%s%s" treemacs-nerd-icons-tab (nerd-icons-faicon "nf-fa-file_o" :face 'treemacs-nerd-icons-file-face) treemacs-nerd-icons-tab)
:extensions (fallback)
:fallback 'same-as-icon)))
(provide 'treemacs-nerd-icons)
;;; treemacs-nerd-icons.el ends here