-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathinit.el
165 lines (123 loc) · 5.97 KB
/
init.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
;;; -*- lexical-binding: t; no-byte-compile: t; -*-
;; startup
(setq package-enable-at-startup nil
load-prefer-newer t
inhibit-startup-screen t)
(add-hook 'after-init-hook #'(lambda ()
(interactive)
(require 'server)
(or (server-running-p)
(server-start))))
;; straight+use-package
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 6))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq use-package-compute-statistics t)
;; performance
;; https://emacs-lsp.github.io/lsp-mode/page/performance/
(setq gc-cons-threshold 100000000
read-process-output-max (* 1024 1024))
;; https://www.masteringemacs.org/article/speed-up-emacs-libjansson-native-elisp-compilation
(if (and (fboundp 'native-comp-available-p)
(native-comp-available-p))
(setq comp-deferred-compilation t
package-native-compile t)
(message "Native complation is *not* available, lsp performance will suffer..."))
(unless (functionp 'json-serialize)
(message "Native JSON is *not* available, lsp performance will suffer..."))
;; do not steal focus while doing async compilations
(setq warning-suppress-types '((comp)))
;; generate spartan configuration file
(setq spartan-config (concat user-emacs-directory "spartan.el"))
(or (file-exists-p spartan-config)
(progn
(with-temp-file spartan-config
(insert ";; Spartan.el Emacs General Settings
(setq spartan-persistent-scratch t ; t or nil
spartan-minimal-modeline t ; t or nil
spartan-preferred-shell \"bash\" ; must be available on PATH
magit-repository-directories '((\"~/repos\" . 1)) ; where your projects live
initial-major-mode 'fundamental-mode
initial-scratch-message \"This is a persistent, unkillable scratch pad, stored to ~/.emacs.d/scratch\")
;; Font settings
(set-face-attribute 'default nil :family \"Monospace\" :height 120)
;; Theme customization settings
(with-eval-after-load 'spartan-theme
(spartan-install-themes
;; Add as many themes to install as you'd like here
modus-themes)
;; Load specific theme variant by modifying here
(load-theme 'modus-vivendi t))
;; Transparency
;; (set-frame-parameter nil 'alpha-background 75) ; This frame
;; (add-to-list 'default-frame-alist '(alpha-background . 75)) ; New frames
;; Dashboard customization settings
(setq dashboard-startup-banner 'ascii)
(setq dashboard-banner-ascii \"
▄████████ ▄▄▄▄███▄▄▄▄ ▄████████ ▄████████ ▄████████
███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███ ███ ███ ███ ███
███ █▀ ███ ███ ███ ███ ███ ███ █▀ ███ █▀
▄███▄▄▄ ███ ███ ███ ███ ███ ███ ███
▀▀███▀▀▀ ███ ███ ███ ▀███████████ ███ ▀███████████
███ █▄ ███ ███ ███ ███ ███ ███ █▄ ███
███ ███ ███ ███ ███ ███ ███ ███ ███ ▄█ ███
██████████ ▀█ ███ █▀ ███ █▀ ████████▀ ▄████████▀
\")
(setq dashboard-center-content t)
(setq dashboard-banner-logo-title \"Spartan edition\")
(and (file-exists-p spartan-first-time-run-has-completed)
(setq dashboard-footer-messages '(\"Vincit qui se vincit.\")))
(setq dashboard-items '((recents . 5)
;; (bookmarks . 5)
;; (projects . 5)
;; (agenda . 5)
;; (registers . 5)
))
;; Layers
(setq spartan-layers '(
spartan-better-defaults
spartan-theme
spartan-dashboard
spartan-vertico
spartan-flymake
spartan-crux
spartan-magit
spartan-projectile
spartan-eglot
spartan-company
spartan-shell
spartan-c
))
"))))
(setq spartan-first-time-run-has-completed (concat user-emacs-directory ".spartan-first-time-run-has-completed"))
(load-file spartan-config)
(or (file-exists-p spartan-first-time-run-has-completed)
(progn
;; This code here executes only on the first-time startup of Spartan Emacs
(setq dashboard-footer-messages '("Tip: Use 'C-c i' to view settings pertaining to Spartan Emacs configuration"))
(with-temp-file spartan-first-time-run-has-completed (insert "Hello"))))
;; spartan-layers
(add-to-list 'load-path (concat user-emacs-directory "spartan-layers"))
(dolist (layer spartan-layers)
(require layer))
;; spartan.d/ loads last
(setq spartan-lisp-d (concat user-emacs-directory "spartan.d"))
(or
(file-directory-p spartan-lisp-d)
(make-directory spartan-lisp-d))
(defun spartan-user-local-hook ()
(when (file-directory-p spartan-lisp-d)
(dolist (file (directory-files spartan-lisp-d nil "^.*\.el$"))
(load-file (concat spartan-lisp-d "/" file)))))
(add-hook 'after-init-hook 'spartan-user-local-hook)
;;; init.el ends here