-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit-fast.el
256 lines (224 loc) · 6.87 KB
/
init-fast.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
;; (message "%s" file-name-handler-alist)
;; (setq debug-on-error t)
(setq frame-title-format '("%b"))
(setq file-name-handler-alist nil)
(defvar my/pkg-loaded '("base"))
(defvar bootstrap-version nil)
(defconst is-lbodnar (string-equal system-name "lbodnar"))
(defvar my/project-dir '("/home/lbodnar/Projects"))
(when (not is-lbodnar)
(setq my/project-dir '("c:/git/mas" "c:/git/mas/WebApiServices")))
(cua-mode t)
(tool-bar-mode -1)
(menu-bar-mode -1)
(blink-cursor-mode 0)
(if is-lbodnar
(set-frame-font "Noto Sans Mono-12" t)
(set-frame-font "Noto Sans Mono-9" t))
(load-theme 'tsdh-light)
;; ################################################
;; just for defuns and entry-points
;;
;; ################################################
(defun my/packages ()
"Load straight package manager"
(interactive)
(when (not bootstrap-version)
(message "package init")
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))))
(defun my/install-modules ()
"install the base modules"
(interactive)
(message "module install")
(straight-use-package 'undo-tree)
(straight-use-package 'ace-window)
(straight-use-package 'rg)
(straight-use-package 'ivy)
(straight-use-package 'counsel)
(straight-use-package 'hydra)
(straight-use-package 'projectile)
(straight-use-package 'markdown-mode)
(straight-use-package 'org)
(message "module install end"))
(global-set-key (kbd "C-M-S-i") 'my/install-modules)
(defun my/default-modules ()
"Load default plugins"
(message "default modules loading")
(let ((my-load-file
(expand-file-name "progs/my-defun.el" user-emacs-directory)))
(load my-load-file))
(straight-use-package 'undo-tree)
(global-undo-tree-mode)
(straight-use-package 'rg)
(recentf-mode)
(straight-use-package 'ace-window)
(my/load-my "keys")
(my/load-my "setq-defaults")
(my/load-my "layout")
(message "default modules loaded"))
(defun my/entrypoint ()
"Initialization for entry points"
(my/packages)
(my/default-modules))
;; entry point for magit, from commands
(defun my/git ()
"T."
(interactive)
(my/entrypoint)
(my/load-my "magit")
(my/magit-status))
;; ******************************************
;; entry points
;; ******************************************
;; entry point for long-line's, from commands
(defun my/long-line ()
"Open long lines plugins"
(interactive)
(let ((ep (line-end-position)))
(message "check long-line, first crln is: %s" ep)
(when (>= ep 1000)
(so-long)
(let ((my-load-file
(expand-file-name "progs/longlines.el" user-emacs-directory)))
(load my-load-file))
(longlines-mode))))
(add-hook 'nxml-mode-hook 'my/long-line)
(add-hook 'json-mode-hook 'my/long-line)
;; entry point
(global-set-key (kbd "C-l") 'my/menu)
(defun my/menu ()
"T."
(interactive)
(my/entrypoint)
(my/load-my "hydra")
(start-hydra))
;; fallback to M-x
(global-set-key (kbd "C-c m") 'execute-extended-command)
;; entry point with M-x
(global-set-key (kbd "M-x") 'my/M-x)
;; entry point with find-file
(global-set-key (kbd "C-o") 'my/find-file)
;; entry point with buffers
(global-set-key (kbd "C-b") 'my/buffers)
(defun ivy-load ()
"Load ivy packages"
(my/entrypoint)
(my/load-my "ivy"))
(defun my/buffers ()
"Load buffers"
(interactive)
(ivy-load)
(counsel-switch-buffer))
(defun my/find-file ()
"Open file"
(interactive)
(ivy-load)
(counsel-find-file))
(defun my/M-x ()
"Load commands"
(interactive)
(ivy-load)
(counsel-M-x))
;; entry point, automatic load the base packages
;; load packages if we have a little time ...
(run-with-idle-timer 1 nil (lambda ()
(my/packages)
(if (file-exists-p "~/.emacs.d/straight/build-cache.el")
(my/default-modules)
(my/install-modules))))
;; entry point, js file
(defun init-js ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.js\\'" . init-js) auto-mode-alist))
(my/load-my "js")
(js2-mode))
(add-to-list 'auto-mode-alist '("\\.js\\'" . init-js))
;; entry point, ts file
(defun init-ts ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.ts\\'" . init-ts) auto-mode-alist))
(my/load-my "js")
(typescript-mode))
(add-to-list 'auto-mode-alist '("\\.ts\\'" . init-ts))
;; entry point, cs file
(defun init-cs ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.cs\\'" . init-cs) auto-mode-alist))
(my/load-my "csharp")
(csharp-mode))
(add-to-list 'auto-mode-alist '("\\.cs\\'" . init-cs))
;; entry point, html file
(defun init-html ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.(html\\|htm\\|cshtml\\|jsx)\\'" . init-html) auto-mode-alist))
(my/load-my "web")
(web-mode))
(add-to-list 'auto-mode-alist '("\\.(html\\|htm\\|cshtml\\|jsx)\\'" . init-html))
;; entry point, less, css file
(defun init-less ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.\\(less\\|css\\)\\'" . init-less) auto-mode-alist))
(my/load-my "web")
(less-css-mode))
(add-to-list 'auto-mode-alist '("\\.\\(less\\|css\\)\\'" . init-less))
;; entry point, haskell
(defun init-hs ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.\\(hs\\)\\'" . init-hs) auto-mode-alist))
(my/load-my "haskell")
(haskell-mode))
(add-to-list 'auto-mode-alist '("\\.\\(hs\\)\\'" . init-hs))
;; entry point, shakespeare
(defun init-shakespeare ()
"T."
(my/entrypoint)
(my/load-my "haskell"))
(add-to-list 'auto-mode-alist '("\\.hamlet\\'" . (lambda ()
(init-shakespeare)
(shakespeare-hamlet-mode))))
(add-to-list 'auto-mode-alist '("\\.julius\\'" . (lambda ()
(init-shakespeare)
(shakespeare-julius-mode))))
(add-to-list 'auto-mode-alist '("\\.lucius\\'" . (lambda ()
(init-shakespeare)
(shakespeare-lucius-mode))))
;; entry point, json file
(defun init-json ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.el\\'" . init-md) auto-mode-alist))
(straight-use-package 'json-mode)
(json-mode))
(add-to-list 'auto-mode-alist '("\\.json\\'" . init-json))
;; entry point, markdown file
(defun init-md ()
"T."
(my/entrypoint)
(straight-use-package 'markdown-mode)
(setq auto-mode-alist (delete '("\\.md\\'" . init-md) auto-mode-alist))
(markdown-mode))
(add-to-list 'auto-mode-alist '("\\.md\\'" . init-md))
;; entry point, emacslisp file
(defun init-elisp ()
"T."
(my/entrypoint)
(setq auto-mode-alist (delete '("\\.el\\'" . init-elisp) auto-mode-alist))
(my/load-my "dev")
(emacs-lisp-mode))
(add-to-list 'auto-mode-alist '("\\.el\\'" . init-elisp))