blob: eddb55958bf6aab744fbab683eedc2ae5a883367 (
plain)
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
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
;; Initialize melpa repo
(require 'package)
(setq package-enable-at-startup nil)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; Initialize use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(use-package org
:config
(add-hook 'org-mode-hook 'org-indent-mode)
(add-hook 'org-mode-hook
(lambda ()
(visual-line-mode 1))))
(use-package org-indent
:diminish org-indent-mode)
(use-package htmlize
:ensure t)
(use-package auto-package-update
:defer nil
:ensure t
:config
(setq auto-package-update-delete-old-versions t)
(setq auto-package-update-hide-results t)
(auto-package-update-maybe))
(use-package diminish
:ensure t)
(use-package spaceline
:ensure t)
(use-package powerline
:ensure t
:init
(spaceline-spacemacs-theme)
:hook
('after-init-hook) . 'powerline-reset)
(use-package dashboard
:ensure t
:defer nil
:preface
(defun update-config ()
"Update Witchmacs to the latest version."
(interactive)
(let ((dir (expand-file-name user-emacs-directory)))
(if (file-exists-p dir)
(progn
(message "Witchmacs is updating!")
(cd dir)
(shell-command "git pull")
(message "Update finished. Switch to the messages buffer to see changes and then restart Emacs"))
(message "\"%s\" doesn't exist." dir))))
(defun create-scratch-buffer ()
"Create a scratch buffer"
(interactive)
(switch-to-buffer (get-buffer-create "*scratch*"))
(lisp-interaction-mode))
:config
(dashboard-setup-startup-hook)
(setq dashboard-items '((recents . 5)))
(setq dashboard-banner-logo-title "W I T C H M A C S - The cutest Emacs distribution!")
(setq dashboard-startup-banner "~/.emacs.d/marivector.png")
(setq dashboard-center-content t)
(setq dashboard-show-shortcuts nil)
(setq dashboard-set-init-info t)
(setq dashboard-init-info (format "%d packages loaded in %s"
(length package-activated-list) (emacs-init-time)))
(setq dashboard-set-footer nil)
(setq dashboard-set-navigator t)
(setq dashboard-navigator-buttons
`(;; line1
((,nil
"Witchmacs on github"
"Open Witchmacs' github page on your browser"
(lambda (&rest _) (browse-url "https://github.com/snackon/witchmacs"))
'default)
(nil
"Witchmacs crash course"
"Open Witchmacs' introduction to Emacs"
(lambda (&rest _) (find-file "~/.emacs.d/Witcheat.org"))
'default)
(nil
"Update Witchmacs"
"Get the latest Witchmacs update. Check out the github commits for changes!"
(lambda (&rest _) (update-config))
'default)
)
;; line 2
((,nil
"Open scratch buffer"
"Switch to the scratch buffer"
(lambda (&rest _) (create-scratch-buffer))
'default)
(nil
"Open config.el"
"Open Witchmacs' configuration file for easy editing"
(lambda (&rest _) (find-file "~/.emacs.d/config.el"))
'default)
(nil
"Open init.el"
"Open init file"
(lambda (&rest _) (find-file "~/.emacs.d/init.el"))
'default)))))
;(insert (concat
; (propertize (format "%d packages loaded in %s"
; (length package-activated-list) (emacs-init-time))
; 'face 'font-lock-comment-face)))
;
;(dashboard-center-line)
(use-package which-key
:ensure t
:diminish which-key-mode
:init
(which-key-mode))
(use-package swiper
:ensure t
:bind ("C-s" . 'swiper))
(use-package evil
:ensure t
:defer nil
:init
(setq evil-want-keybinding nil)
(setq evil-want-C-u-scroll t)
:config
(evil-mode 1))
;(use-package evil-collection
; :after evil
; :ensure t
; :config
; (evil-collection-init))
(use-package beacon
:ensure t
:diminish beacon-mode
:init
(beacon-mode 1))
(use-package avy
:ensure t
:bind
("M-s" . avy-goto-char))
(use-package switch-window
:ensure t
:config
(setq switch-window-input-style 'minibuffer)
(setq switch-window-increase 4)
(setq switch-window-threshold 2)
(setq switch-window-shortcut-style 'qwerty)
(setq switch-window-qwerty-shortcuts
'("a" "s" "d" "f" "j" "k" "l"))
:bind
([remap other-window] . switch-window))
(use-package ido
:init
(ido-mode 1)
:config
(setq ido-enable-flex-matching nil)
(setq ido-create-new-buffer 'always)
(setq ido-everywhere t))
(use-package ido-vertical-mode
:ensure t
:init
(ido-vertical-mode 1))
; This enables arrow keys to select while in ido mode. If you want to
; instead use the default Emacs keybindings, change it to
; "'C-n-and-C-p-only"
(setq ido-vertical-define-keys 'C-n-C-p-up-and-down)
(use-package async
:ensure t
:init
(dired-async-mode 1))
(use-package page-break-lines
:ensure t
:diminish (page-break-lines-mode visual-line-mode))
(use-package undo-tree
:ensure t
:diminish undo-tree-mode)
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if (executable-find "python3") 3 0)
treemacs-deferred-git-apply-delay 0.5
treemacs-display-in-side-window t
treemacs-eldoc-display t
treemacs-file-event-delay 5000
treemacs-file-follow-delay 0.2
treemacs-follow-after-init t
treemacs-git-command-pipe ""
treemacs-goto-tag-strategy 'refetch-index
treemacs-indentation 2
treemacs-indentation-string " "
treemacs-is-never-other-window nil
treemacs-max-git-entries 5000
treemacs-missing-project-action 'ask
treemacs-no-png-images nil
treemacs-no-delete-other-windows t
treemacs-project-follow-cleanup nil
treemacs-persist-file (expand-file-name ".cache/treemacs-persist" user-emacs-directory)
treemacs-recenter-distance 0.1
treemacs-recenter-after-file-follow nil
treemacs-recenter-after-tag-follow nil
treemacs-recenter-after-project-jump 'always
treemacs-recenter-after-project-expand 'on-distance
treemacs-show-cursor nil
treemacs-show-hidden-files t
treemacs-silent-filewatch nil
treemacs-silent-refresh nil
treemacs-sorting 'alphabetic-desc
treemacs-space-between-root-nodes t
treemacs-tag-follow-cleanup t
treemacs-tag-follow-delay 1.5
treemacs-width 30)
(treemacs-resize-icons 11)
(treemacs-follow-mode t)
(treemacs-filewatch-mode t)
(treemacs-fringe-indicator-mode t)
(pcase (cons (not (null (executable-find "git")))
(not (null (executable-find "python3"))))
(`(t . t)
(treemacs-git-mode 'deferred))
(`(t . _)
(treemacs-git-mode 'simple))))
:bind
(:map global-map
("M-0" . treemacs-select-window)
("C-x t 1" . treemacs-delete-other-windows)
("C-x t t" . treemacs)
("C-x t B" . treemacs-bookmark)
("C-x t C-t" . treemacs-find-file)
("C-x t M-t" . treemacs-find-tag)))
(use-package treemacs-evil
:after treemacs evil
:ensure t)
(use-package treemacs-icons-dired
:after treemacs dired
:ensure t
:config (treemacs-icons-dired-mode))
(use-package magit
:ensure t)
(use-package eldoc
:diminish eldoc-mode)
(use-package abbrev
:diminish abbrev-mode)
(use-package company
:ensure t
:diminish (meghanada-mode company-mode irony-mode)
:config
(setq company-idle-delay 0)
(setq company-minimum-prefix-length 3)
(define-key company-active-map (kbd "M-n") nil)
(define-key company-active-map (kbd "M-p") nil)
(define-key company-active-map (kbd "C-n") #'company-select-next)
(define-key company-active-map (kbd "C-p") #'company-select-previous)
(define-key company-active-map (kbd "SPC") #'company-abort)
:hook
((java-mode c-mode c++-mode) . company-mode))
(use-package yasnippet
:ensure t
:diminish yas-minor-mode
:hook
((c-mode c++-mode) . yas-minor-mode)
:config
(yas-reload-all))
(use-package yasnippet-snippets
:ensure t)
(use-package company-c-headers
:defer nil
:ensure t)
(use-package company-irony
:defer nil
:ensure t
:config
(setq company-backends '((company-c-headers
company-dabbrev-code
company-irony))))
(use-package irony
:defer nil
:ensure t
:config
:hook
((c++-mode c-mode) . irony-mode)
('irony-mode-hook) . 'irony-cdb-autosetup-compile-options)
(use-package meghanada
:ensure t
:defer nil
:config
(add-hook 'java-mode-hook
(lambda ()
(meghanada-mode t)))
(setq meghanada-java-path "java")
(setq meghanada-maven-path "mvn"))
|