|
1 |
| -(setq inhibit-startup-message t) |
| 1 | +(defun mb/display-startup-time () |
| 2 | + (message "Emacs loaded in %s with %d garbage collections." |
| 3 | + (format "%.2f seconds" |
| 4 | + (float-time |
| 5 | + (time-subtract after-init-time before-init-time))) |
| 6 | + gcs-done)) |
| 7 | +(add-hook 'emacs-startup-hook #'mb/display-startup-time) |
2 | 8 |
|
3 |
| -(scroll-bar-mode -1) ; Disable visible scrollbar |
4 |
| -(tool-bar-mode -1) ; Disable the toolbar |
5 |
| -(tooltip-mode -1) ; Disable tooltips |
6 |
| -(set-fringe-mode 10) ; Give some breathing room |
7 | 9 |
|
8 |
| -(menu-bar-mode -1) ; Disable the menu bar |
9 | 10 |
|
10 |
| -;; Set up the visible bell |
11 |
| -(setq visible-bell nil) |
| 11 | +;; Initialize package sources |
| 12 | +(require 'package) |
12 | 13 |
|
13 |
| -(column-number-mode) |
14 |
| -(global-display-line-numbers-mode t) |
| 14 | +(setq package-archives '(("melpa" . "https://melpa.org/packages/") |
| 15 | + ("org" . "https://orgmode.org/elpa/") |
| 16 | + ("elpa" . "https://elpa.gnu.org/packages/"))) |
| 17 | + |
| 18 | +(package-initialize) |
| 19 | +(unless package-archive-contents |
| 20 | + (package-refresh-contents)) |
| 21 | + |
| 22 | +(require 'use-package) |
| 23 | +(setq use-package-always-ensure t) |
| 24 | + |
| 25 | +(use-package auto-package-update |
| 26 | + :custom |
| 27 | + (auto-package-update-interval 7) |
| 28 | + (auto-package-update-prompt-before-update t) |
| 29 | + (auto-package-update-hide-results t) |
| 30 | + :config |
| 31 | + (auto-package-update-maybe) |
| 32 | + (auto-package-update-at-time "09:00")) |
| 33 | + |
| 34 | +;; NOTE: If you want to move everything out of the ~/.emacs.d folder |
| 35 | +;; reliably, set `user-emacs-directory` before loading no-littering! |
| 36 | +;(setq user-emacs-directory "~/.cache/emacs") |
| 37 | + |
| 38 | +(use-package no-littering) |
| 39 | + |
| 40 | +;; no-littering doesn't set this by default so we must place |
| 41 | +;; auto save files in the same path as it uses for sessions |
| 42 | +(setq auto-save-file-name-transforms |
| 43 | + `((".*" ,(no-littering-expand-var-file-name "auto-save/") t))) |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + ; ========= VIM ============= |
| 50 | + |
| 51 | +;; Make ESC quit prompts |
| 52 | +(global-set-key (kbd "<escape>") 'keyboard-escape-quit) |
| 53 | + |
| 54 | +(use-package evil |
| 55 | + :init |
| 56 | + (setq evil-want-integration t) |
| 57 | + (setq evil-want-keybinding nil) |
| 58 | + (setq evil-want-C-u-scroll t) |
| 59 | + (setq evil-want-C-i-jump nil) |
| 60 | + :config |
| 61 | + (evil-mode 1) |
| 62 | + (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state) |
| 63 | + (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join) |
| 64 | + |
| 65 | + ;; Use visual line motions even outside of visual-line-mode buffers |
| 66 | + (evil-global-set-key 'motion "j" 'evil-next-visual-line) |
| 67 | + (evil-global-set-key 'motion "k" 'evil-previous-visual-line) |
| 68 | + |
| 69 | + (evil-set-initial-state 'messages-buffer-mode 'normal) |
| 70 | + (evil-set-initial-state 'dashboard-mode 'normal)) |
| 71 | + |
| 72 | +(use-package evil-collection |
| 73 | + :after evil |
| 74 | + :config |
| 75 | + (evil-collection-init)) |
| 76 | + |
| 77 | +(use-package evil-nerd-commenter |
| 78 | + :bind ("M-/" . evilnc-comment-or-uncomment-lines)) |
| 79 | + |
| 80 | +(use-package rainbow-delimiters |
| 81 | + :hook (prog-mode . rainbow-delimiters-mode)) |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + ; ===== COMPLETION ======== |
| 87 | + |
| 88 | + |
| 89 | +;; Enable vertico |
| 90 | +(use-package vertico |
| 91 | + :init |
| 92 | + (vertico-mode) |
| 93 | + |
| 94 | + ;; Different scroll margin |
| 95 | + ;; (setq vertico-scroll-margin 0) |
| 96 | + |
| 97 | + ;; Show more candidates |
| 98 | + ;; (setq vertico-count 20) |
| 99 | + |
| 100 | + ;; Grow and shrink the Vertico minibuffer |
| 101 | + ;; (setq vertico-resize t) |
| 102 | + |
| 103 | + ;; Optionally enable cycling for `vertico-next' and `vertico-previous'. |
| 104 | + ;; (setq vertico-cycle t) |
| 105 | + ) |
| 106 | + |
| 107 | +(use-package orderless |
| 108 | + :ensure t |
| 109 | + :custom |
| 110 | + (completion-styles '(orderless basic)) |
| 111 | + (completion-category-overrides '((file (styles basic partial-completion))))) |
| 112 | + |
| 113 | +(use-package marginalia |
| 114 | + :ensure t |
| 115 | + :config |
| 116 | + (marginalia-mode)) |
| 117 | + |
| 118 | + |
| 119 | + |
| 120 | +;; Example configuration for Consult |
| 121 | +(use-package consult |
| 122 | + ;; Replace bindings. Lazily loaded due by `use-package'. |
| 123 | + :bind (;; C-c bindings in `mode-specific-map' |
| 124 | + ;; C-x bindings in `ctl-x-map' |
| 125 | + ("C-x b" . consult-buffer) ;; orig. switch-to-buffer |
| 126 | + ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer |
| 127 | + ;; Custom M-# bindings for fast register access |
| 128 | + ;; Other custom bindings |
| 129 | + ("M-y" . consult-yank-pop) ;; orig. yank-pop |
| 130 | + ;; M-g bindings in `goto-map' |
| 131 | + ("M-g g" . consult-goto-line) ;; orig. goto-line |
| 132 | + ("M-g o" . consult-outline) ;; Alternative: consult-org-heading |
| 133 | + ;; M-s bindings in `search-map' |
| 134 | + ("M-s f" . consult-fd) ;; Alternative: consult-fd |
| 135 | + ("M-s g" . consult-git-grep) |
| 136 | + ("M-s r" . consult-ripgrep) |
| 137 | + ("M-s l" . consult-line) |
| 138 | + ("M-s k" . consult-keep-lines) |
| 139 | + ("M-s u" . consult-focus-lines) |
| 140 | + ;; Minibuffer history |
| 141 | + :map minibuffer-local-map |
| 142 | + ("M-s" . consult-history) ;; orig. next-matching-history-element |
| 143 | + ("M-r" . consult-history)) ;; orig. previous-matching-history-element |
| 144 | +) |
| 145 | + |
| 146 | + |
| 147 | +(use-package embark |
| 148 | + :ensure t |
| 149 | + |
| 150 | + :bind |
| 151 | + (("C-." . embark-act) ;; pick some comfortable binding |
| 152 | + ("C-;" . embark-dwim) ;; good alternative: M-. |
| 153 | + ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' |
| 154 | + |
| 155 | + :init |
| 156 | + |
| 157 | + ;; Optionally replace the key help with a completing-read interface |
| 158 | + (setq prefix-help-command #'embark-prefix-help-command) |
| 159 | + |
| 160 | + ;; Show the Embark target at point via Eldoc. You may adjust the Eldoc |
| 161 | + ;; strategy, if you want to see the documentation from multiple providers. |
| 162 | + (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) |
| 163 | + ;; (setq eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly) |
| 164 | + |
| 165 | + :config |
| 166 | + |
| 167 | + ;; Hide the mode line of the Embark live/completions buffers |
| 168 | + (add-to-list 'display-buffer-alist |
| 169 | + '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" |
| 170 | + nil |
| 171 | + (window-parameters (mode-line-format . none))))) |
| 172 | + |
| 173 | +;; Consult users will also want the embark-consult package. |
| 174 | +(use-package embark-consult |
| 175 | + :ensure t ; only need to install it, embark loads it after consult if found |
| 176 | + :hook |
| 177 | + (embark-collect-mode . consult-preview-at-point-mode)) |
| 178 | + |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + ; ========= HISTORY ============= |
15 | 184 |
|
16 | 185 |
|
17 |
| -(hl-line-mode 1) |
18 | 186 | (recentf-mode 1)
|
19 | 187 |
|
20 | 188 | ;; Save what you enter into minibuffer prompts
|
|
38 | 206 | (setq global-auto-revert-non-file-buffers t)
|
39 | 207 |
|
40 | 208 |
|
| 209 | +; ======== Basic UI =========== |
| 210 | + |
| 211 | +(setq inhibit-startup-message t) |
| 212 | + |
| 213 | +(scroll-bar-mode -1) ; Disable visible scrollbar |
| 214 | +(tool-bar-mode -1) ; Disable the toolbar |
| 215 | +(tooltip-mode -1) ; Disable tooltips |
| 216 | +(set-fringe-mode 10) ; Give some breathing room |
| 217 | + |
| 218 | +(menu-bar-mode -1) ; Disable the menu bar |
| 219 | + |
| 220 | +;; Set up the visible bell |
| 221 | +(setq visible-bell nil) |
| 222 | + |
| 223 | +(column-number-mode) |
| 224 | +(global-display-line-numbers-mode t) |
| 225 | + |
| 226 | + |
| 227 | + |
| 228 | +; ========= Theme ============ |
| 229 | + |
| 230 | + |
| 231 | +(hl-line-mode 1) |
| 232 | + |
41 | 233 | ;; Configure the Modus Themes' appearance
|
42 | 234 | (setq modus-themes-mode-line '(accented borderless)
|
43 | 235 | modus-themes-bold-constructs t
|
|
0 commit comments