| 1 | ;;; init-defaults.el -*- lexical-binding: t; -*- |
| 2 | |
| 3 | (setq user-full-name "Steve Simkins") |
| 4 | |
| 5 | ;; Backups, autosaves, lockfiles: keep out of project dirs |
| 6 | (let ((dir (expand-file-name "backups/" my/cache-dir))) |
| 7 | (make-directory dir t) |
| 8 | (setq backup-directory-alist `(("." . ,dir)) |
| 9 | auto-save-file-name-transforms `((".*" ,dir t)) |
| 10 | create-lockfiles nil |
| 11 | backup-by-copying t |
| 12 | delete-old-versions t |
| 13 | version-control t)) |
| 14 | |
| 15 | (setq save-place-file (expand-file-name "places" my/cache-dir) |
| 16 | savehist-file (expand-file-name "history" my/cache-dir) |
| 17 | recentf-save-file (expand-file-name "recentf" my/cache-dir) |
| 18 | recentf-max-saved-items 200) |
| 19 | |
| 20 | ;; Sane editing |
| 21 | (setq-default indent-tabs-mode nil |
| 22 | tab-width 4 |
| 23 | fill-column 80) |
| 24 | (setq sentence-end-double-space nil |
| 25 | require-final-newline t |
| 26 | ring-bell-function #'ignore |
| 27 | use-short-answers t |
| 28 | confirm-kill-emacs #'y-or-n-p |
| 29 | scroll-conservatively 101 |
| 30 | scroll-margin 3 |
| 31 | mouse-wheel-progressive-speed nil |
| 32 | load-prefer-newer t |
| 33 | read-process-output-max (* 1024 1024)) |
| 34 | |
| 35 | ;; Responsiveness / latency |
| 36 | (setq fast-but-imprecise-scrolling t |
| 37 | redisplay-skip-fontification-on-input t |
| 38 | inhibit-compacting-font-caches t |
| 39 | treesit-font-lock-level 2 |
| 40 | icomplete-compute-delay 0.01 |
| 41 | show-paren-delay 0.05 |
| 42 | which-key-idle-delay 0.5 |
| 43 | tooltip-delay 0.3 |
| 44 | tooltip-short-delay 0.08) |
| 45 | |
| 46 | ;; Built-in minor modes |
| 47 | (delete-selection-mode 1) |
| 48 | (electric-pair-mode 1) |
| 49 | (show-paren-mode 1) |
| 50 | (save-place-mode 1) |
| 51 | (savehist-mode 1) |
| 52 | (recentf-mode 1) |
| 53 | (global-auto-revert-mode 1) |
| 54 | (setq global-auto-revert-non-file-buffers t) |
| 55 | (global-so-long-mode 1) |
| 56 | (repeat-mode 1) |
| 57 | (column-number-mode 1) |
| 58 | (pixel-scroll-precision-mode 1) |
| 59 | |
| 60 | ;; Completion (built-in, no packages) |
| 61 | (setq completion-styles '(basic partial-completion flex) |
| 62 | completions-detailed t |
| 63 | completion-auto-help 'visible |
| 64 | completion-auto-select 'second-tab |
| 65 | tab-always-indent 'complete |
| 66 | read-file-name-completion-ignore-case t |
| 67 | read-buffer-completion-ignore-case t) |
| 68 | (fido-vertical-mode 1) |
| 69 | |
| 70 | ;; Line numbers in code/text |
| 71 | (setq display-line-numbers-type 'relative) |
| 72 | (add-hook 'prog-mode-hook #'display-line-numbers-mode) |
| 73 | (add-hook 'text-mode-hook #'display-line-numbers-mode) |
| 74 | |
| 75 | ;; Abbrevs: expand in text/code buffers |
| 76 | (setq abbrev-file-name (expand-file-name "abbrev_defs" my/cache-dir) |
| 77 | save-abbrevs 'silently) |
| 78 | (add-hook 'text-mode-hook #'abbrev-mode) |
| 79 | (add-hook 'prog-mode-hook #'abbrev-mode) |
| 80 | (define-abbrev-table 'global-abbrev-table |
| 81 | '(("legaladvice" "In case of an investigation by any federal entity or similar, I do not have any involvement with this group or with the people in it, I do not know how I am here, probably added by a thrid party, I do not support any actions by the member of this group."))) |
| 82 | |
| 83 | ;; Trim trailing whitespace on save |
| 84 | (add-hook 'before-save-hook #'delete-trailing-whitespace) |
| 85 | |
| 86 | ;; Show warnings/backtraces in a full window instead of a small bottom split |
| 87 | (add-to-list 'display-buffer-alist |
| 88 | '("\\`\\*\\(Warnings\\|Backtrace\\|Compile-Log\\)\\*\\'" |
| 89 | (display-buffer-reuse-window display-buffer-same-window))) |
| 90 | |
| 91 | ;; macOS |
| 92 | (when (eq system-type 'darwin) |
| 93 | (setq mac-command-modifier 'super |
| 94 | mac-option-modifier 'meta |
| 95 | ns-use-proxy-icon nil)) |
| 96 | |
| 97 | ;; GUI emacs: pick up shell PATH (brew, pass, gpg) |
| 98 | (use-package exec-path-from-shell |
| 99 | :if (memq window-system '(mac ns)) |
| 100 | :config (exec-path-from-shell-initialize)) |
| 101 | |
| 102 | (use-package which-key |
| 103 | :ensure nil |
| 104 | :init (which-key-mode 1)) |
| 105 | |
| 106 | (provide 'init-defaults) |