about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.el174
1 files changed, 168 insertions, 6 deletions
diff --git a/init.el b/init.el index d458f96..00a1707 100644 --- a/init.el +++ b/init.el
@@ -101,35 +101,197 @@
101 (auto-save-list-file-prefix 101 (auto-save-list-file-prefix
102 ,(acdw/in-dir "auto-save-list/.saves-" t)))) 102 ,(acdw/in-dir "auto-save-list/.saves-" t))))
103(auto-save-visited-mode +1) 103(auto-save-visited-mode +1)
104
105(defun hook--auto-save-when-unfocused ()
106 "Save all buffers when out of focus."
107 (acdw/when-unfocused #'save-some-buffers t))
108(add-function :after after-focus-change-function
109 #'hook--auto-save-when-unfocused)
110
104;; Auto-revert 111;; Auto-revert
105(when (require 'autorevert) 112(when (require 'autorevert)
106 (global-auto-revert-mode +1)) 113 (global-auto-revert-mode +1))
107;; Save place 114;; Save place
108(when (require 'saveplace) 115(when (require 'saveplace)
109 (acdw/set 116 (acdw/set
110 `((save-place-file ,(acdw/in-dir "places")) 117 `((save-place-file ,(acdw/in-dir "places.el"))
111 (save-place-forget-unreadable-files ,(eq acdw/system :home)))) 118 (save-place-forget-unreadable-files ,(eq acdw/system :home))))
112 (save-place-mode +1)) 119 (save-place-mode +1))
113;; Recent files 120;; Recent files
114(when (require 'recentf) 121(when (require 'recentf)
115 (acdw/set 122 (acdw/set
116 `((recentf-save-file ,(acdw/in-dir "recentf")) 123 `((recentf-save-file ,(acdw/in-dir "recentf.el"))
117 (recentf-max-menu-items 100) 124 (recentf-max-menu-items 100)
118 (recentf-max-saved-items nil) 125 (recentf-max-saved-items nil)
119 (recentf-auto-cleanup 10 "Cleanup the recentf list when idle for 10s.")) 126 (recentf-auto-cleanup 10 "Cleanup the recentf list when idle for 10s.")))
120 (add-to-list 'recentf-exclude acdw/dir) 127 (add-to-list 'recentf-exclude acdw/dir)
121 (recentf-mode +1))) 128 (recentf-mode +1))
122 129
123;; Move the custom file 130;; Move the custom file
124(acdw/set `((custom-file ,(acdw/in-dir "custom.el")))) 131(acdw/set `((custom-file ,(acdw/in-dir "custom.el"))))
125 132
126;; Cursor 133;; Cursor
127(acdw/set '((cursor-type bar) 134(acdw/set '((cursor-type bar)
128 (cursor-in-non-selected-windows 'box))) 135 (cursor-in-non-selected-windows hollow)))
129 136
130(defun hook--overwrite-mode-change-cursor () 137(defun hook--overwrite-mode-change-cursor ()
131 (setq cursor-type (if overwrite-mode t 'bar))) 138 (setq cursor-type (if overwrite-mode t 'bar)))
132(add-hook 'overwrite-mode-hook #'hook--overwrite-mode-change-cursor) 139(add-hook 'overwrite-mode-hook #'hook--overwrite-mode-change-cursor)
133 140
141;; Scrolling
142(acdw/set '((auto-window-vscroll nil)
143 (fast-but-imprecise-scrolling t)
144 (scroll-margin 0)
145 (scroll-conservatively 101)
146 (scroll-preserve-screen-position 1)))
147
134;; Bindings 148;; Bindings
135(acdw/bind "C-h" 'ehelp-command :after ("ehelp" nil nil 'keymap)) 149(acdw/bind "C-h" ehelp-command :after ("ehelp" nil nil 'keymap))
150
151;;; Startup
152(acdw/set `((inhibit-startup-screen t)
153 (initial-buffer-choice t)
154 (initial-scratch-message ,(concat
155 ";; Howdy, "
156 (nth 0 (split-string user-full-name)) "!"
157 " Welcome to GNU Emacs.\n\n"))))
158
159;;; Minibuffer
160
161;; Save history
162(when (require 'savehist)
163 (acdw/set `((savehist-additional-variables
164 (kill-ring search-ring regexp-search-ring))
165 (history-length t)
166 (history-delete-duplicates t)
167 (savehist-autosave-interval 6)
168 (savehist-file ,(acdw/in-dir "savehist.el"))))
169 (savehist-mode +1))
170
171;; Icomplete (-vertical)
172(when (require 'icomplete)
173 (acdw/set '((completion-ignore-case t)
174 (read-buffer-completion-ignore-case t)
175 (completion-styles (substring flex))
176 (completion-category-overrides ((file
177 (styles basic substring flex))))
178 (icomplete-delay-completions-threshold 0)
179 (icomplete-max-delay-chars 0)
180 (icomplete-compute-delay 0)
181 (icomplete-show-matches-on-no-input t)
182 (icomplete-with-buffer-completion-tables t)
183 (icomplete-in-buffer t)))
184 (acdw/pkg icomplete-vertical
185 :binds (("<down>" icomplete-forward-completions
186 :map icomplete-minibuffer-map)
187 ("C-n" icomplete-forward-completions
188 :map icomplete-minibuffer-map)
189 ("<up>" icomplete-backward-completions
190 :map icomplete-minibuffer-map)
191 ("C-p" icomplete-backward-completions
192 :map icomplete-minibuffer-map)
193 ("C-v" icomplete-vertical-toggle
194 :map icomplete-minibuffer-map))
195 :now ((fido-mode -1)
196 (icomplete-mode +1)
197 (icomplete-vertical-mode +1))))
198
199;; Consult
200(acdw/pkg consult
201 :binds (;; C-c bindings (`mode-specific-map')
202 ("C-c h" consult-history)
203 ("C-c m" consult-mode-command)
204 ;; C-x bindings (`ctl-x-map')
205 ("C-x M-:" consult-complex-command)
206 ("C-x b" consult-buffer)
207 ("C-x 4 b" consult-buffer-other-window)
208 ("C-x 5 b" consult-buffer-other-frame)
209 ("C-x r x" consult-register)
210 ("C-x r b" consult-bookmark)
211 ;; M-g bindings (`goto-map')
212 ("M-g g" consult-line)
213 ("M-g M-g" consult-line)
214 ("M-g o" consult-outline)
215 ("M-g m" consult-mark)
216 ("M-g k" consult-global-mark)
217 ("M-g i" consult-imenu)
218 ("M-g e" consult-error)
219 ;; M-s bindings (`search-map')
220 ("M-s g" consult-grep) ; alts:
221 ; consult-git-grep,
222 ; consult-ripgrep
223 ("M-s f" consult-find) ; alts:
224 ; consult-locate
225 ("M-s l" consult-line)
226 ("M-s m" consult-multi-occur)
227 ("M-s k" consult-keep-lines)
228 ("M-s u" consult-focus-lines)
229 ;; Other bindings
230 ("M-y" consult-yank-pop)
231 ("<f1> a" consult-apropos)
232 ("C-h a" consult-apropos))
233 :now ((autoload 'consult-register-preview "consult")
234 (acdw/set '((register-preview-delay 0)
235 (register-preview-function #'consult-register-preview)))))
236
237;; Marginalia
238(acdw/pkg marginalia
239 :now ((acdw/set '((marginalia-annotators (marginalia-annotators-heavy
240 marginalia-annotators-light))))
241 (marginalia-mode +1)))
242
243;; Imenu
244(when (require 'imenu)
245 (acdw/set '((imenu-auto-rescan t))))
246
247;;; Packages
248
249;; Undo-fu
250(acdw/pkg undo-fu
251 :binds (("C-/" undo-fu-only-undo)
252 ("C-?" undo-fu-only-redo)))
253(acdw/pkg undo-fu-session
254 :now ((acdw/set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'"
255 "/git-rebase-todo\\'"))
256 (undo-fu-session-directory ,(acdw/in-dir "undo/" t)))))
257 :then ((global-undo-fu-session-mode +1)))
258
259;; Modus themes
260(acdw/pkg (modus-themes
261 :host gitlab
262 :repo "protesilaos/modus-themes")
263 :now ((acdw/set `((modus-themes-slanted-constructs t)
264 (modus-themes-bold-constructs t)
265 (modus-themes-region 'bg-only)
266 (modus-themes-org-blocks 'grayscale)
267 (modus-themes-headings ((1 . section)
268 (t . no-color)))
269 (modus-themes-scale-headings nil)
270 (modus-themes-mode-line nil)))
271 (acdw/sunrise-sunset #'modus-themes-load-operandi
272 #'modus-themes-load-vivendi))
273 :then
274 ((dolist (face '(modus-theme-heading-1
275 modus-theme-heading-2
276 modus-theme-heading-3
277 modus-theme-heading-4
278 modus-theme-heading-5
279 modus-theme-heading-6
280 modus-theme-heading-7
281 modus-theme-heading-8))
282 (acdw/set-face face
283 `((t (:inherit (fixed-pitch bold))))))))
284
285;;; Magit
286
287(acdw/pkg magit
288 :binds (("g" magit-status :map acdw/leader)))
289
290;;; Miscellaneous
291
292(acdw/set '((disabled-command-function nil)
293 (load-prefer-newer t)
294 (comp-async-report-warnings-errors nil)))
295(fset 'yes-or-no-p #'y-or-n-p)
296
297;;; init.el ends here