diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 387 |
1 files changed, 214 insertions, 173 deletions
diff --git a/init.el b/init.el index 2301e64..2422c97 100644 --- a/init.el +++ b/init.el | |||
@@ -42,31 +42,31 @@ | |||
42 | ;; I don't want `visual-line-mode', because I really only want to wrap and | 42 | ;; I don't want `visual-line-mode', because I really only want to wrap and |
43 | ;; truncate lines. Believe me, I know what I'm doing. | 43 | ;; truncate lines. Believe me, I know what I'm doing. |
44 | (acdw/set '((word-wrap t) | 44 | (acdw/set '((word-wrap t) |
45 | (truncate-lines t))) | 45 | (truncate-lines nil))) |
46 | 46 | ||
47 | ;; Whitespace | 47 | ;; Whitespace |
48 | (acdw/set '((whitespace-style | 48 | (acdw/set '((whitespace-style |
49 | (empty indentation space-before-tab space-after-tab)) | 49 | (empty indentation space-before-tab space-after-tab)) |
50 | (indent-tabs-mode t) | 50 | (indent-tabs-mode nil "We've lost this battle...") |
51 | (tab-width 8))) | 51 | (tab-width 4))) |
52 | (add-hook 'before-save-hook #'whitespace-cleanup) | 52 | (add-hook 'before-save-hook #'whitespace-cleanup) |
53 | 53 | ||
54 | ;; Pairs | 54 | ;; Pairs |
55 | (add-hook 'prog-mode-hook #'electric-pair-local-mode) | 55 | (add-hook 'prog-mode-hook #'electric-pair-local-mode) |
56 | (acdw/set '((show-paren-delay 0) | 56 | (acdw/set '((show-paren-delay 0) |
57 | (show-paren-style mixed) | 57 | (show-paren-style mixed) |
58 | (show-paren-when-point-inside-paren t) | 58 | (show-paren-when-point-inside-paren t) |
59 | (show-paren-when-point-in-periphery t))) | 59 | (show-paren-when-point-in-periphery t))) |
60 | (show-paren-mode +1) | 60 | (show-paren-mode +1) |
61 | 61 | ||
62 | ;; Killing & Yanking | 62 | ;; Killing & Yanking |
63 | (delete-selection-mode +1) | 63 | (delete-selection-mode +1) |
64 | (acdw/set '((save-interprogram-paste-before-kill t) | 64 | (acdw/set '((save-interprogram-paste-before-kill t) |
65 | (yank-pop-change-selection t) | 65 | (yank-pop-change-selection t) |
66 | (x-select-enable-clipboard t) | 66 | (x-select-enable-clipboard t) |
67 | (x-select-enable-primary t) | 67 | (x-select-enable-primary t) |
68 | (mouse-drag-copy-region t) | 68 | (mouse-drag-copy-region t) |
69 | (kill-do-not-save-duplicates t))) | 69 | (kill-do-not-save-duplicates t))) |
70 | 70 | ||
71 | ;; Encoding | 71 | ;; Encoding |
72 | (set-charset-priority 'unicode) | 72 | (set-charset-priority 'unicode) |
@@ -77,39 +77,39 @@ | |||
77 | (set-keyboard-coding-system 'utf-8-unix) | 77 | (set-keyboard-coding-system 'utf-8-unix) |
78 | (set-selection-coding-system 'utf-8-unix) | 78 | (set-selection-coding-system 'utf-8-unix) |
79 | (acdw/set '((locale-coding-system utf-8-unix) | 79 | (acdw/set '((locale-coding-system utf-8-unix) |
80 | (coding-system-for-read utf-8-unix) | 80 | (coding-system-for-read utf-8-unix) |
81 | (coding-system-for-write utf-8-unix) | 81 | (coding-system-for-write utf-8-unix) |
82 | (buffer-file-coding-system utf-8-unix) | 82 | (buffer-file-coding-system utf-8-unix) |
83 | (org-export-coding-system utf-8-unix) | 83 | (org-export-coding-system utf-8-unix) |
84 | (org-html-coding-system utf-8-unix) | 84 | (org-html-coding-system utf-8-unix) |
85 | (default-process-coding-system (utf-8-unix . utf-8-unix)) | 85 | (default-process-coding-system (utf-8-unix . utf-8-unix)) |
86 | (x-select-request-type (UTF8_STRING COMPOUND_TEXT TEXT STRING)))) | 86 | (x-select-request-type (UTF8_STRING COMPOUND_TEXT TEXT STRING)))) |
87 | 87 | ||
88 | ;; Unique buffer names | 88 | ;; Unique buffer names |
89 | (when (require 'uniquify) | 89 | (when (require 'uniquify) |
90 | (acdw/set '((uniquify-buffer-name-style forward) | 90 | (acdw/set '((uniquify-buffer-name-style forward) |
91 | (uniquify-separator "/") | 91 | (uniquify-separator "/") |
92 | (uniquify-after-kill-buffer-p t) | 92 | (uniquify-after-kill-buffer-p t) |
93 | (uniquify-ignore-buffers-re "^\\*")))) | 93 | (uniquify-ignore-buffers-re "^\\*")))) |
94 | 94 | ||
95 | ;; Backups | 95 | ;; Backups |
96 | (acdw/set `((backup-by-copying t) | 96 | (acdw/set `((backup-by-copying t) |
97 | (delete-old-versions -1) | 97 | (delete-old-versions -1) |
98 | (version-control t) | 98 | (version-control t) |
99 | (vc-make-backup-files t) | 99 | (vc-make-backup-files t) |
100 | (backup-directory-alist ((".*" . ,(acdw/in-dir "backup/" t)))))) | 100 | (backup-directory-alist ((".*" . ,(acdw/in-dir "backup/" t)))))) |
101 | ;; Autosaves | 101 | ;; Autosaves |
102 | (acdw/set `((auto-save-file-name-transforms | 102 | (acdw/set `((auto-save-file-name-transforms |
103 | ((".*" ,(acdw/in-dir "auto-save/" t) t))) | 103 | ((".*" ,(acdw/in-dir "auto-save/" t) t))) |
104 | (auto-save-list-file-prefix | 104 | (auto-save-list-file-prefix |
105 | ,(acdw/in-dir "auto-save-list/.saves-" t)))) | 105 | ,(acdw/in-dir "auto-save-list/.saves-" t)))) |
106 | (auto-save-visited-mode +1) | 106 | (auto-save-visited-mode +1) |
107 | 107 | ||
108 | (defun hook--auto-save-when-unfocused () | 108 | (defun hook--auto-save-when-unfocused () |
109 | "Save all buffers when out of focus." | 109 | "Save all buffers when out of focus." |
110 | (acdw/when-unfocused #'save-some-buffers t)) | 110 | (acdw/when-unfocused #'save-some-buffers t)) |
111 | (add-function :after after-focus-change-function | 111 | (add-function :after after-focus-change-function |
112 | #'hook--auto-save-when-unfocused) | 112 | #'hook--auto-save-when-unfocused) |
113 | 113 | ||
114 | ;; Auto-revert | 114 | ;; Auto-revert |
115 | (when (require 'autorevert) | 115 | (when (require 'autorevert) |
@@ -135,7 +135,7 @@ | |||
135 | 135 | ||
136 | ;; Cursor | 136 | ;; Cursor |
137 | (acdw/set '((cursor-type bar) | 137 | (acdw/set '((cursor-type bar) |
138 | (cursor-in-non-selected-windows hollow))) | 138 | (cursor-in-non-selected-windows hollow))) |
139 | 139 | ||
140 | (defun hook--overwrite-mode-change-cursor () | 140 | (defun hook--overwrite-mode-change-cursor () |
141 | (setq cursor-type (if overwrite-mode 'hbar 'bar))) | 141 | (setq cursor-type (if overwrite-mode 'hbar 'bar))) |
@@ -143,113 +143,113 @@ | |||
143 | 143 | ||
144 | ;; Scrolling | 144 | ;; Scrolling |
145 | (acdw/set '((auto-window-vscroll nil) | 145 | (acdw/set '((auto-window-vscroll nil) |
146 | (fast-but-imprecise-scrolling t) | 146 | (fast-but-imprecise-scrolling t) |
147 | (scroll-margin 0) | 147 | (scroll-margin 0) |
148 | (scroll-conservatively 101) | 148 | (scroll-conservatively 101) |
149 | (scroll-preserve-screen-position 1))) | 149 | (scroll-preserve-screen-position 1))) |
150 | 150 | ||
151 | ;; Bindings | 151 | ;; Bindings |
152 | (acdw/binds (("C-h" ehelp-command :after ("ehelp" nil nil 'keymap)) | 152 | (acdw/binds (("C-h" ehelp-command :after ("ehelp" nil nil 'keymap)) |
153 | ([remap just-one-space] cycle-spacing) | 153 | ([remap just-one-space] cycle-spacing) |
154 | ("M-/" hippie-expand) | 154 | ("M-/" hippie-expand) |
155 | ("M-=" count-words) | 155 | ("M-=" count-words) |
156 | ("C-x C-b" ibuffer))) | 156 | ("C-x C-b" ibuffer))) |
157 | 157 | ||
158 | ;;; Startup | 158 | ;;; Startup |
159 | (acdw/set `((inhibit-startup-screen t) | 159 | (acdw/set `((inhibit-startup-screen t) |
160 | (initial-buffer-choice t) | 160 | (initial-buffer-choice t) |
161 | (initial-scratch-message | 161 | (initial-scratch-message |
162 | ,(concat ";; Howdy, " | 162 | ,(concat ";; Howdy, " |
163 | (nth 0 (split-string user-full-name)) "!" | 163 | (nth 0 (split-string user-full-name)) "!" |
164 | " Welcome to GNU Emacs.\n\n")))) | 164 | " Welcome to GNU Emacs.\n\n")))) |
165 | 165 | ||
166 | ;;; Minibuffer | 166 | ;;; Minibuffer |
167 | 167 | ||
168 | (acdw/set '((minibuffer-prompt-properties (read-only t | 168 | (acdw/set '((minibuffer-prompt-properties (read-only t |
169 | cursor-intangible t | 169 | cursor-intangible t |
170 | face minibuffer-prompt)) | 170 | face minibuffer-prompt)) |
171 | (enable-recursive-minibuffers t) | 171 | (enable-recursive-minibuffers t) |
172 | (file-name-shadow-properties (invisible t)))) | 172 | (file-name-shadow-properties (invisible t)))) |
173 | (minibuffer-depth-indicate-mode +1) | 173 | (minibuffer-depth-indicate-mode +1) |
174 | (file-name-shadow-mode +1) | 174 | (file-name-shadow-mode +1) |
175 | 175 | ||
176 | ;; Save history | 176 | ;; Save history |
177 | (when (require 'savehist) | 177 | (when (require 'savehist) |
178 | (acdw/set `((savehist-additional-variables | 178 | (acdw/set `((savehist-additional-variables |
179 | (kill-ring search-ring regexp-search-ring)) | 179 | (kill-ring search-ring regexp-search-ring)) |
180 | (history-length t) | 180 | (history-length t) |
181 | (history-delete-duplicates t) | 181 | (history-delete-duplicates t) |
182 | (savehist-autosave-interval 6) | 182 | (savehist-autosave-interval 6) |
183 | (savehist-file ,(acdw/in-dir "savehist.el")))) | 183 | (savehist-file ,(acdw/in-dir "savehist.el")))) |
184 | (savehist-mode +1)) | 184 | (savehist-mode +1)) |
185 | 185 | ||
186 | ;; Icomplete (-vertical) | 186 | ;; Icomplete (-vertical) |
187 | (when (require 'icomplete) | 187 | (when (require 'icomplete) |
188 | (acdw/set '((completion-ignore-case t) | 188 | (acdw/set '((completion-ignore-case t) |
189 | (read-buffer-completion-ignore-case t) | 189 | (read-buffer-completion-ignore-case t) |
190 | (icomplete-delay-completions-threshold 0) | 190 | (icomplete-delay-completions-threshold 0) |
191 | (icomplete-max-delay-chars 0) | 191 | (icomplete-max-delay-chars 0) |
192 | (icomplete-compute-delay 0) | 192 | (icomplete-compute-delay 0) |
193 | (icomplete-show-matches-on-no-input t) | 193 | (icomplete-show-matches-on-no-input t) |
194 | (icomplete-with-buffer-completion-tables t) | 194 | (icomplete-with-buffer-completion-tables t) |
195 | (icomplete-in-buffer t))) | 195 | (icomplete-in-buffer t))) |
196 | (acdw/pkg orderless | 196 | (acdw/pkg orderless |
197 | :set '((completion-styles (orderless)))) | 197 | :set '((completion-styles (orderless)))) |
198 | (acdw/pkg icomplete-vertical | 198 | (acdw/pkg icomplete-vertical |
199 | :binds (("<down>" icomplete-forward-completions | 199 | :binds (("<down>" icomplete-forward-completions |
200 | :map icomplete-minibuffer-map) | 200 | :map icomplete-minibuffer-map) |
201 | ("C-n" icomplete-forward-completions | 201 | ("C-n" icomplete-forward-completions |
202 | :map icomplete-minibuffer-map) | 202 | :map icomplete-minibuffer-map) |
203 | ("<up>" icomplete-backward-completions | 203 | ("<up>" icomplete-backward-completions |
204 | :map icomplete-minibuffer-map) | 204 | :map icomplete-minibuffer-map) |
205 | ("C-p" icomplete-backward-completions | 205 | ("C-p" icomplete-backward-completions |
206 | :map icomplete-minibuffer-map) | 206 | :map icomplete-minibuffer-map) |
207 | ("C-v" icomplete-vertical-toggle | 207 | ("C-v" icomplete-vertical-toggle |
208 | :map icomplete-minibuffer-map)) | 208 | :map icomplete-minibuffer-map)) |
209 | :now ((fido-mode -1) | 209 | :now ((fido-mode -1) |
210 | (icomplete-mode +1) | 210 | (icomplete-mode +1) |
211 | (icomplete-vertical-mode +1)))) | 211 | (icomplete-vertical-mode +1)))) |
212 | 212 | ||
213 | ;; Consult | 213 | ;; Consult |
214 | (acdw/pkg consult | 214 | (acdw/pkg consult |
215 | :binds (;; C-c bindings (`mode-specific-map') | 215 | :binds (;; C-c bindings (`mode-specific-map') |
216 | ("C-c h" consult-history) | 216 | ("C-c h" consult-history) |
217 | ("C-c m" consult-mode-command) | 217 | ("C-c m" consult-mode-command) |
218 | ;; C-x bindings (`ctl-x-map') | 218 | ;; C-x bindings (`ctl-x-map') |
219 | ("C-x M-:" consult-complex-command) | 219 | ("C-x M-:" consult-complex-command) |
220 | ("C-x b" consult-buffer) | 220 | ("C-x b" consult-buffer) |
221 | ("C-x 4 b" consult-buffer-other-window) | 221 | ("C-x 4 b" consult-buffer-other-window) |
222 | ("C-x 5 b" consult-buffer-other-frame) | 222 | ("C-x 5 b" consult-buffer-other-frame) |
223 | ("C-x r x" consult-register) | 223 | ("C-x r x" consult-register) |
224 | ("C-x r b" consult-bookmark) | 224 | ("C-x r b" consult-bookmark) |
225 | ;; M-g bindings (`goto-map') | 225 | ;; M-g bindings (`goto-map') |
226 | ("M-g o" consult-outline) | 226 | ("M-g o" consult-outline) |
227 | ("M-g m" consult-mark) | 227 | ("M-g m" consult-mark) |
228 | ("M-g k" consult-global-mark) | 228 | ("M-g k" consult-global-mark) |
229 | ("M-g i" consult-imenu) | 229 | ("M-g i" consult-imenu) |
230 | ("M-g e" consult-error) | 230 | ("M-g e" consult-error) |
231 | ;; M-s bindings (`search-map') | 231 | ;; M-s bindings (`search-map') |
232 | ("M-s g" consult-grep) ; alts: | 232 | ("M-s g" consult-grep) ; alts: |
233 | ; consult-git-grep, | 233 | ; consult-git-grep, |
234 | ; consult-ripgrep | 234 | ; consult-ripgrep |
235 | ("M-s f" consult-find) ; alts: | 235 | ("M-s f" consult-find) ; alts: |
236 | ; consult-locate | 236 | ; consult-locate |
237 | ("M-s l" consult-line) | 237 | ("M-s l" consult-line) |
238 | ("M-s m" consult-multi-occur) | 238 | ("M-s m" consult-multi-occur) |
239 | ("M-s k" consult-keep-lines) | 239 | ("M-s k" consult-keep-lines) |
240 | ("M-s u" consult-focus-lines) | 240 | ("M-s u" consult-focus-lines) |
241 | ;; Other bindings | 241 | ;; Other bindings |
242 | ("M-y" consult-yank-pop) | 242 | ("M-y" consult-yank-pop) |
243 | ("<f1> a" consult-apropos) | 243 | ("<f1> a" consult-apropos) |
244 | ("C-h a" consult-apropos)) | 244 | ("C-h a" consult-apropos)) |
245 | :now ((autoload 'consult-register-preview "consult")) | 245 | :now ((autoload 'consult-register-preview "consult")) |
246 | :set '((register-preview-delay 0) | 246 | :set '((register-preview-delay 0) |
247 | (register-preview-function #'consult-register-preview))) | 247 | (register-preview-function #'consult-register-preview))) |
248 | 248 | ||
249 | ;; Marginalia | 249 | ;; Marginalia |
250 | (acdw/pkg marginalia | 250 | (acdw/pkg marginalia |
251 | :set '((marginalia-annotators (marginalia-annotators-heavy | 251 | :set '((marginalia-annotators (marginalia-annotators-heavy |
252 | marginalia-annotators-light))) | 252 | marginalia-annotators-light))) |
253 | :now ((marginalia-mode +1))) | 253 | :now ((marginalia-mode +1))) |
254 | 254 | ||
255 | ;; Imenu | 255 | ;; Imenu |
@@ -264,36 +264,41 @@ | |||
264 | ;; Undo-fu | 264 | ;; Undo-fu |
265 | (acdw/pkg undo-fu | 265 | (acdw/pkg undo-fu |
266 | :binds (("C-/" undo-fu-only-undo) | 266 | :binds (("C-/" undo-fu-only-undo) |
267 | ("C-?" undo-fu-only-redo))) | 267 | ("C-?" undo-fu-only-redo))) |
268 | (acdw/pkg undo-fu-session | 268 | (acdw/pkg undo-fu-session |
269 | :set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'" | 269 | :set `((undo-fu-session-incompatible-files ("/COMMIT_EDITMSG\\'" |
270 | "/git-rebase-todo\\'")) | 270 | "/git-rebase-todo\\'")) |
271 | (undo-fu-session-directory ,(acdw/in-dir "undo/" t))) | 271 | (undo-fu-session-directory ,(acdw/in-dir "undo/" t))) |
272 | :then ((global-undo-fu-session-mode +1))) | 272 | :then ((global-undo-fu-session-mode +1))) |
273 | 273 | ||
274 | ;; Modus themes | 274 | ;; Modus themes |
275 | (acdw/pkg (modus-themes | 275 | (acdw/pkg (modus-themes |
276 | :host gitlab | 276 | :host gitlab |
277 | :repo "protesilaos/modus-themes") | 277 | :repo "protesilaos/modus-themes") |
278 | :set `((modus-themes-slanted-constructs t) | 278 | :set `((modus-themes-slanted-constructs t) |
279 | (modus-themes-bold-constructs t) | 279 | (modus-themes-bold-constructs t) |
280 | (modus-themes-region 'bg-only) | 280 | (modus-themes-region 'bg-only) |
281 | (modus-themes-org-blocks 'grayscale) | 281 | (modus-themes-org-blocks 'grayscale) |
282 | (modus-themes-headings ((1 . section) | 282 | (modus-themes-headings ((1 . section) |
283 | (t . no-color))) | 283 | (t . no-color))) |
284 | (modus-themes-scale-headings nil) | 284 | (modus-themes-scale-headings nil) |
285 | (modus-themes-mode-line nil)) | 285 | (modus-themes-mode-line nil)) |
286 | :now ((acdw/sunrise-sunset #'modus-themes-load-operandi | 286 | :now ((acdw/sunrise-sunset #'modus-themes-load-operandi |
287 | #'modus-themes-load-vivendi))) | 287 | #'modus-themes-load-vivendi))) |
288 | 288 | ||
289 | ;; Expand-region | 289 | ;; Expand-region |
290 | (acdw/pkg expand-region | 290 | (acdw/pkg expand-region |
291 | :binds (("C-=" er/expand-region))) | 291 | :binds (("C-=" er/expand-region))) |
292 | 292 | ||
293 | ;; CRUX | ||
294 | (acdw/pkg crux | ||
295 | :binds (("M-o" crux-other-window-or-switch-buffer) | ||
296 | ([remap move-beginning-of-line] crux-move-beginning-of-line) | ||
297 | ([remap kill-line] crux-kill-and-join-forward))) | ||
293 | ;;; Frame title | 298 | ;;; Frame title |
294 | 299 | ||
295 | (acdw/set `((frame-title-format | 300 | (acdw/set `((frame-title-format |
296 | "%b %+%* GNU Emacs"))) | 301 | "%b %+%* GNU Emacs"))) |
297 | 302 | ||
298 | ;;; Mode line | 303 | ;;; Mode line |
299 | 304 | ||
@@ -303,19 +308,19 @@ | |||
303 | ;; Simple mode line | 308 | ;; Simple mode line |
304 | (acdw/pkg simple-modeline | 309 | (acdw/pkg simple-modeline |
305 | :set '((simple-modeline-segments | 310 | :set '((simple-modeline-segments |
306 | ((;; left | 311 | ((;; left |
307 | acdw-modeline/modified | 312 | acdw-modeline/modified |
308 | acdw-modeline/buffer-name | 313 | acdw-modeline/buffer-name |
309 | simple-modeline-segment-position | 314 | simple-modeline-segment-position |
310 | simple-modeline-segment-word-count) | 315 | simple-modeline-segment-word-count) |
311 | (;; right | 316 | (;; right |
312 | acdw-modeline/vc-branch | 317 | acdw-modeline/vc-branch |
313 | simple-modeline-segment-misc-info | 318 | simple-modeline-segment-misc-info |
314 | simple-modeline-segment-process | 319 | simple-modeline-segment-process |
315 | acdw-modeline/minions | 320 | acdw-modeline/minions |
316 | simple-modeline-segment-major-mode)))) | 321 | simple-modeline-segment-major-mode)))) |
317 | :now ((require 'acdw-modeline) | 322 | :now ((require 'acdw-modeline) |
318 | (simple-modeline-mode +1))) | 323 | (simple-modeline-mode +1))) |
319 | 324 | ||
320 | ;;; Magit | 325 | ;;; Magit |
321 | 326 | ||
@@ -325,75 +330,75 @@ | |||
325 | ;;; Web browsing | 330 | ;;; Web browsing |
326 | 331 | ||
327 | (acdw/set '((browse-url-browser-function browse-url-firefox) | 332 | (acdw/set '((browse-url-browser-function browse-url-firefox) |
328 | (browse-url-new-window-flag t) | 333 | (browse-url-new-window-flag t) |
329 | (browse-url-firefox-new-window-is-tab t) | 334 | (browse-url-firefox-new-window-is-tab t) |
330 | (shr-max-width fill-column) | 335 | (shr-max-width fill-column) |
331 | (shr-width fill-column))) | 336 | (shr-width fill-column))) |
332 | 337 | ||
333 | (when (eq acdw/system :work) | 338 | (when (eq acdw/system :work) |
334 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")) | 339 | (add-to-list 'exec-path "C:/Program Files/Mozilla Firefox")) |
335 | 340 | ||
336 | (acdw/hooks ((text-mode-hook goto-address-mode) | 341 | (acdw/hooks ((text-mode-hook goto-address-mode) |
337 | (prog-mode-hook goto-address-prog-mode))) | 342 | (prog-mode-hook goto-address-prog-mode))) |
338 | 343 | ||
339 | ;;; Dired | 344 | ;;; Dired |
340 | (acdw/pkg dired | 345 | (acdw/pkg dired |
341 | :local t | 346 | :local t |
342 | :set `((dired-recursive-copies always) | 347 | :set `((dired-recursive-copies always) |
343 | (dired-recursive-deletes always) | 348 | (dired-recursive-deletes always) |
344 | (delete-by-moving-to-trash t) | 349 | (delete-by-moving-to-trash t) |
345 | (dired-listing-switches "-Al") | 350 | (dired-listing-switches "-Al") |
346 | (ls-lisp-dirs-first t) | 351 | (ls-lisp-dirs-first t) |
347 | (dired-dwim-target t)) | 352 | (dired-dwim-target t)) |
348 | :now ((autoload 'dired-mode-map "dired" nil nil 'keymap) | 353 | :now ((autoload 'dired-mode-map "dired" nil nil 'keymap) |
349 | (acdw/pkg dired-subtree) | 354 | (acdw/pkg dired-subtree) |
350 | (acdw/pkg dired-x | 355 | (acdw/pkg dired-x |
351 | :local t | 356 | :local t |
352 | :binds (("C-x C-j" dired-jump))) | 357 | :binds (("C-x C-j" dired-jump))) |
353 | (acdw/pkg dired-collapse | 358 | (acdw/pkg dired-collapse |
354 | :hooks ((dired-mode-hook dired-collapse-mode))) | 359 | :hooks ((dired-mode-hook dired-collapse-mode))) |
355 | (defun hook--dired-mode () | 360 | (defun hook--dired-mode () |
356 | (hl-line-mode +1) | 361 | (hl-line-mode +1) |
357 | (dired-hide-details-mode +1))) | 362 | (dired-hide-details-mode +1))) |
358 | :hooks ((dired-mode-hook hook--dired-mode)) | 363 | :hooks ((dired-mode-hook hook--dired-mode)) |
359 | :binds (("i" dired-subtree-toggle :map dired-mode-map))) | 364 | :binds (("i" dired-subtree-toggle :map dired-mode-map))) |
360 | 365 | ||
361 | ;;; Eshell | 366 | ;;; Eshell |
362 | 367 | ||
363 | (acdw/set `((eshell-directory-name ,(acdw/in-dir "eshell/" t)) | 368 | (acdw/set `((eshell-directory-name ,(acdw/in-dir "eshell/" t)) |
364 | (eshell-aliases-file ,(acdw/in-dir "eshell/aliases" t)))) | 369 | (eshell-aliases-file ,(acdw/in-dir "eshell/aliases" t)))) |
365 | 370 | ||
366 | ;;; Org-mode | 371 | ;;; Org-mode |
367 | (acdw/pkg (org | 372 | (acdw/pkg (org |
368 | :repo "https://code.orgmode.org/bzg/org-mode.git") | 373 | :repo "https://code.orgmode.org/bzg/org-mode.git") |
369 | :now ((require 'acdw-org)) | 374 | :now ((require 'acdw-org)) |
370 | :set `((org-directory "~/org") | 375 | :set `((org-directory "~/org") |
371 | (org-hide-emphasis-markers t) | 376 | (org-hide-emphasis-markers t) |
372 | (org-fontify-whole-heading-line t) | 377 | (org-fontify-whole-heading-line t) |
373 | (org-fontify-done-headline t) | 378 | (org-fontify-done-headline t) |
374 | (org-fontify-quote-and-verse-blocks t) | 379 | (org-fontify-quote-and-verse-blocks t) |
375 | (org-src-fontify-natively t) | 380 | (org-src-fontify-natively t) |
376 | (org-pretty-entities t) | 381 | (org-pretty-entities t) |
377 | (org-tags-column ,(- 0 fill-column -3)) | 382 | (org-tags-column ,(- 0 fill-column -3)) |
378 | (org-src-tab-acts-natively t) | 383 | (org-src-tab-acts-natively t) |
379 | (org-src-window-setup current-window) | 384 | (org-src-window-setup current-window) |
380 | (org-confirm-babel-evaluate nil) | 385 | (org-confirm-babel-evaluate nil) |
381 | (org-adapt-indentation nil) | 386 | (org-adapt-indentation nil) |
382 | (org-catch-invisible-edits smart) | 387 | (org-catch-invisible-edits smart) |
383 | (org-special-ctrl-a/e t) | 388 | (org-special-ctrl-a/e t) |
384 | (org-special-ctrl-k t) | 389 | (org-special-ctrl-k t) |
385 | (org-imenu-depth 3) | 390 | (org-imenu-depth 3) |
386 | (org-export-headline-levels 8) | 391 | (org-export-headline-levels 8) |
387 | (org-export-with-smart-quotes t) | 392 | (org-export-with-smart-quotes t) |
388 | (org-export-with-sub-superscripts t)) | 393 | (org-export-with-sub-superscripts t)) |
389 | :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) | 394 | :hooks ((before-save-hook acdw/hook--org-mode-fix-blank-lines)) |
390 | :binds (("RET" unpackaged/org-return-dwim | 395 | :binds (("RET" unpackaged/org-return-dwim |
391 | :map org-mode-map :map-after 'org))) | 396 | :map org-mode-map :map-after 'org))) |
392 | 397 | ||
393 | ;;; Nov.el -- ebook reader | 398 | ;;; Nov.el -- ebook reader |
394 | (acdw/pkg nov | 399 | (acdw/pkg nov |
395 | :now ((autoload #'nov-mode "nov") | 400 | :now ((autoload #'nov-mode "nov") |
396 | (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) | 401 | (add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))) |
397 | :set `((nov-text-width ,fill-column))) | 402 | :set `((nov-text-width ,fill-column))) |
398 | 403 | ||
399 | ;;; 0x0 -- upload files | 404 | ;;; 0x0 -- upload files |
@@ -402,9 +407,40 @@ | |||
402 | 407 | ||
403 | ;;; Programming languages | 408 | ;;; Programming languages |
404 | 409 | ||
410 | ;; General | ||
411 | |||
412 | (acdw/set `((smie-indent-basic ,tab-width))) | ||
413 | |||
414 | ;; Formatting | ||
415 | |||
416 | (acdw/pkg (apheleia | ||
417 | :host github | ||
418 | :repo "raxod502/apheleia") | ||
419 | :now ((apheleia-global-mode +1)) | ||
420 | :then ((add-to-list 'apheleia-formatters | ||
421 | '(shfmt . ("shfmt"))) | ||
422 | (add-to-list 'apheleia-mode-alist | ||
423 | '(sh-mode . shfmt)))) | ||
424 | |||
425 | ;; Shell(s) | ||
426 | (when (executable-find "shellcheck") | ||
427 | (acdw/pkg flymake-shellcheck | ||
428 | :hooks ((sh-mode-hook (flymake-mode | ||
429 | flymake-shellcheck-load))))) | ||
430 | |||
431 | (acdw/set `((sh-basic-offset ,tab-width) | ||
432 | (sh-indent-after-case 0) | ||
433 | (sh-indent-for-case-alt +) | ||
434 | (sh-indent-for-case-label 0))) | ||
435 | |||
436 | (defun hook--sh-mode-indent-like-shfmt () | ||
437 | "Try to mirror `shfmt' formatting in shell scripts." | ||
438 | (setq indent-tabs-mode t)) | ||
439 | (add-hook 'sh-mode-hook #'hook--sh-mode-indent-like-shfmt) | ||
440 | |||
405 | ;; Emacs lisp | 441 | ;; Emacs lisp |
406 | (acdw/set '((eval-expression-print-length nil) | 442 | (acdw/set '((eval-expression-print-length nil) |
407 | (eval-expression-print-level nil))) | 443 | (eval-expression-print-level nil))) |
408 | 444 | ||
409 | (when (require 'cl-lib) | 445 | (when (require 'cl-lib) |
410 | (setq-default lisp-indent-function #'common-lisp-indent-function) | 446 | (setq-default lisp-indent-function #'common-lisp-indent-function) |
@@ -419,11 +455,16 @@ | |||
419 | ;; Racket | 455 | ;; Racket |
420 | (acdw/pkg racket-mode) | 456 | (acdw/pkg racket-mode) |
421 | 457 | ||
458 | ;; Web stuff | ||
459 | (acdw/set '((css-indent-offset 2) | ||
460 | (js-indent-level 2) | ||
461 | (sgml-indent-offset 2))) | ||
462 | |||
422 | ;;; Miscellaneous | 463 | ;;; Miscellaneous |
423 | 464 | ||
424 | (acdw/set '((disabled-command-function nil) | 465 | (acdw/set '((disabled-command-function nil) |
425 | (load-prefer-newer t) | 466 | (load-prefer-newer t) |
426 | (comp-async-report-warnings-errors nil))) | 467 | (comp-async-report-warnings-errors nil))) |
427 | 468 | ||
428 | (fset 'yes-or-no-p #'y-or-n-p) | 469 | (fset 'yes-or-no-p #'y-or-n-p) |
429 | 470 | ||
@@ -439,6 +480,6 @@ | |||
439 | (defun hook--gc-when-unfocused () | 480 | (defun hook--gc-when-unfocused () |
440 | (acdw/when-unfocused #'garbage-collect)) | 481 | (acdw/when-unfocused #'garbage-collect)) |
441 | (add-function :after after-focus-change-function | 482 | (add-function :after after-focus-change-function |
442 | #'hook--gc-when-unfocused) | 483 | #'hook--gc-when-unfocused) |
443 | 484 | ||
444 | ;;; init.el ends here | 485 | ;;; init.el ends here |