1 #+TITLE: My New Emacs Config
2 #+AUTHOR: Benjamin Stürz
8 (set-face-attribute 'default nil :height 70)
9 (add-to-list 'bdf-directory-list (expand-file-name "~/.local/share/fonts"))
10 ;(add-to-list 'bdf-directory-list "a")
12 ;;(defalias 'yes-or-no-p 'y-or-no-p)
16 #+begin_src emacs-lisp
18 (setq package-archives '(("melpa" . "https://melpa.org/packages/")
19 ("org" . "https://orgmode.org/elpa/")
20 ("elpa" . "https://elpa.gnu.org/packages/")))
23 (unless package-archive-contents
24 (package-refresh-contents))
26 ;; Initialize use-package
27 (unless (package-installed-p 'use-package)
28 (package-install 'use-package))
30 (require 'use-package)
31 (setq use-package-always-ensure t)
32 ;;(setq use-package-verbose t)
34 (use-package no-littering)
35 (setq auto-save-file-name-transforms `((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))
36 (setq backup-directory-alist `(("." . ,(no-littering-expand-var-file-name "auto-save/"))))
40 #+begin_src emacs-lisp
41 (scroll-bar-mode -1) ;; Disable visible scroll bar
42 (tool-bar-mode -1) ;; Disable the toolbar
43 (tooltip-mode -1) ;; Disable tooltips
44 (menu-bar-mode -1) ;; Disable the menubar
45 (set-fringe-mode 10) ;; Give some breathing room
46 (column-number-mode) ;;
47 (setq display-line-numbers-type 'relative) ;; Relative line numbers
48 (global-display-line-numbers-mode t) ;; Display line numbers
49 (recentf-mode 1) ;; Save recently opened files mode
50 ;;(recentf-load-list) ;; Load recently opened files
51 (setq history-length 100) ;;
52 (savehist-mode 1) ;; Save history
53 (save-place-mode 1) ;; Save place in file
54 (setq global-auto-revert-non-file-buffers t)
55 (global-auto-revert-mode 1) ;;
59 #+begin_src emacs-lisp
60 (setq ring-bell-function 'ignore ;; Disable the bell
61 inhibit-startup-message t ;; Don't display the startup screen
62 scroll-step 1 ;; Make scrolling smoother
63 scroll-conservatively 10000 ;; Remove the jumpiness
64 use-dialog-box nil ;; Don't show the dialog box
65 custom-file (locate-user-emacs-file "custom.el"))
67 (load custom-file 'noerror 'nomessage)
69 ;; Make the frame fullscreen
70 (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
71 (add-to-list 'default-frame-alist '(fullscreen . maximized))
73 ;; Disable line numbers for some modes
74 (dolist (mode '(term-mode-hook
79 (add-hook mode (lambda () (display-line-numbers-mode 0))))
84 #+begin_src emacs-lisp
85 (use-package doom-themes
87 (load-theme 'doom-palenight t))
89 (use-package rainbow-delimiters
90 :hook (prog-mode . rainbow-delimiters-mode))
92 ;; (use-package all-the-icons
93 ;; :if (display-graphic-p)
94 ;; :commands all-the-icons-install-fonts
96 ;; (unless (find-font (font-spec :name "all-the-icons"))
97 ;; (all-the-icons-install-fonts t)))
101 ;; (setq x-underline-at-descent-line t
102 ;; mood-mode-line-height 10)
103 ;; (moody-replace-mode-line-buffer-identification)
104 ;; (moody-replace-vc-mode)
105 ;; (moody-replace-eldoc-minibuffer-message-function))
107 ;;(use-package doom-modeline
109 ;; (doom-modeline-mode 1)
111 ;; (doom-modeline-height 10))
115 #+begin_src emacs-lisp
116 (use-package page-break-lines)
117 (use-package dashboard
118 :after page-break-lines
120 (setq initial-buffer-choice (lambda () (get-buffer-create "*dashboard*"))
121 dashboard-banner-logo-title "Emacs Dashboard"
122 dashboard-startup-banner 'logo
123 dashboard-center-content t
124 dashboard-set-heading-icons t
125 dashboard-set-file-icons t
126 dashboard-set-navigator t
127 dashboard-items '((recents . 5) (bookmarks . 5) (projects . 5) (agenda . 5) (registers . 5)))
128 (dashboard-setup-startup-hook))
132 #+begin_src emacs-lisp
133 (if (version< emacs-version "28.1")
135 (use-package undo-fu)
136 (setq benni/redo 'undo-fu))
137 (setq benni/redo 'undo-redo))
140 #+begin_src emacs-lisp
143 (setq evil-want-integration t
144 evil-want-keybinding nil
145 evil-want-C-u-scroll t
146 evil-want-C-i-jump nil
147 evil-want-fine-undo t
148 evil-undo-system benni/redo)
152 (define-key evil-insert-state-map (kbd "C-g") 'evil-normal-state)
153 (define-key evil-insert-state-map (kbd "C-h") 'evil-delete-backward-char-and-join)
154 (define-key evil-normal-state-map (kbd "C-.") 'evil-switch-to-windows-last-buffer)
155 (global-set-key (kbd "C-.") 'evil-switch-to-windows-last-buffer)
157 ;; Use visual line motions even outside of visual-line-mode buffers.
158 (evil-global-set-key 'motion "j" 'evil-next-visual-line)
159 (evil-global-set-key 'motion "k" 'evil-previous-visual-line)
161 (evil-set-initial-state 'messages-buffer-mode 'normal)
162 (evil-set-initial-state 'dashboard-mode 'normal))
164 (use-package evil-collection
167 (evil-collection-init))
171 #+begin_src emacs-lisp
174 :bind (("C-s" . swiper)
175 :map ivy-minibuffer-map
176 ("TAB" . ivy-alt-done))
180 (use-package ivy-rich
185 (use-package ivy-prescient
186 :after (ivy counsel prescient)
188 (setq ivy-prescient-retain-classic-highlighting t)
189 (ivy-prescient-mode 1))
193 #+begin_src emacs-lisp
196 :bind (("M-x" . counsel-M-x)
197 ("C-x b" . counsel-ibuffer)
198 ("C-x C-f" . counsel-find-file)
199 :map minibuffer-local-map
200 ("C-r" . 'counsel-minibuffer-history))
202 (setq ivy-initial-inputs-alist nil))
204 (use-package counsel-projectile
205 :after (counsel projectile)
206 :config (counsel-projectile-mode))
210 #+begin_src emacs-lisp
213 :hook (lsp-mode . company-mode)
215 (:map lsp-mode-map ("<tab>" . company-indent-or-complete-common))
216 (:map company-active-map ("<tab>" . company-complete-selection))
218 (company-minimum-prefix-length 1)
219 (company-idle-delay 0.5))
221 (use-package company-box
222 :hook (company-mode . company-box-mode))
224 (use-package company-prescient
225 :after (company prescient)
227 (company-prescient-mode 1))
231 #+begin_src emacs-lisp
232 (use-package flycheck
237 #+begin_src emacs-lisp
238 (use-package prescient
240 (setq prescient-sort-length-enable t
241 prescient-filter-method '(literal regexp initialism))
242 (prescient-persist-mode 1))
246 #+begin_src emacs-lisp
247 (use-package which-key
248 :diminish which-key-mode
251 (setq which-key-idle-delay 0.5))
255 #+begin_src emacs-lisp
258 :commands (helpful-callable helpful-variable helpful-command helpful-key)
260 (counsel-describe-function-function #'helpful-callable)
261 (counsel-describe-variable-function #'helpful-variable)
263 ([remap describe-function] . counsel-describe-function)
264 ([remap describe-variable] . counsel-describe-variable)
265 ([remap describe-command] . helpful-command)
266 ([remap describe-key] . helpful-key))
270 #+begin_src emacs-lisp
274 (setq vterm-max-scrollback 10000))
278 #+begin_src emacs-lisp
279 (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
283 (general-create-definer
285 :keymaps '(normal insert visual emacs)
287 :global-prefix "C-SPC"))
293 "." '(counsel-find-file :which-key "open file")
294 "V" '(vterm-other-window :which-key "vterm-other-window")
295 "b" '(:ignore t :which-key "buffer")
296 "bK" '(kill-buffer :which-key "kill buffer")
297 "bb" '(counsel-switch-buffer :which-key "switch buffer")
298 "bk" '(kill-current-buffer :which-key "kill current buffer")
299 "c" '(counsel-compile :which-key "compile")
300 "g" '(magit-status :which-key "magit")
301 "m" '(mu4e :which-key "mu4e")
302 "r" '(counsel-recentf :which-key "recent files")
303 "t" '(:ignore t :which-key "toggles")
304 "tm" '(treemacs :which-key "treemacs")
305 "ts" '(hydra-text-scale/body :which-key "scale text")
306 "tt" '(counsel-load-theme :which-key "choose theme")
307 "v" '(vterm :which-key "vterm"))
309 (defhydra hydra-text-scale
312 ("+" text-scale-increase "in")
313 ("-" text-scale-decrease "out"))
317 #+begin_src emacs-lisp
320 :commands (magit-status)
322 (setq magit-display-buffer-function #'magit-display-buffer-fullframe-status-v1))
326 #+begin_src emacs-lisp
327 (use-package treemacs
330 :bind (:map treemacs-mode-map
331 ("J" . treemacs-select-directory))
333 (setq treemacs-width 25))
335 (use-package treemacs-evil
336 :after (treemacs evil))
338 (use-package treemacs-projectile
339 :after (treemacs projectile))
341 (use-package treemacs-magit
342 :after (treemacs magit))
346 #+begin_src emacs-lisp
347 (use-package projectile
348 :diminish projectile-mode
349 :config (projectile-mode)
350 :custom ((projectile-completion-system 'ivy))
351 :bind-keymap ("C-c p" . projectile-command-map)
353 (when (file-directory-p "~/src")
354 (setq projectile-project-searchpath '("~/src")))
355 (setq projectile-switch-project-action #'projectile-dired))
360 #+begin_src emacs-lisp
361 (use-package gnuplot)
362 (defun benni/org-mode-setup ()
364 (variable-pitch-mode 0)
367 (setq evil-auto-indent nil))
370 #+begin_src emacs-lisp
374 :hook (org-mode . benni/org-mode-setup)
376 (setq org-ellipsis " ▾"
377 org-hide-emphasis-markers t
379 org-agenda-start-with-log-mode t
380 org-log-into-drawer t
381 org-confirm-babel-evaluate nil))
385 #+begin_src emacs-lisp
386 (use-package org-tempo
390 (setq org-structure-template-alist '(("c" . "src c")
391 ("bash" . "src bash")
394 ("java" . "src java")
395 ("el" . "src emacs-lisp")
396 ("a" . "export ascii")
400 ("h" . "export html")
401 ("l" . "export latex")
408 #+begin_src emacs-lisp
409 (use-package org-bullets
411 :hook (org-mode . org-bullets-mode)
413 (org-bullets-bullet-list '("◉" "○" "●" "○" "●" "○" "●")))
417 #+begin_src emacs-lisp
418 (use-package ob-rust)
419 (org-babel-do-load-languages 'org-babel-load-languages '((shell . t)
428 #+begin_src emacs-lisp
429 (use-package lsp-mode
430 :commands (lsp lsp-deferred)
432 (setq lsp-keymap-prefix "C-c l")
434 (lsp-enable-which-key-integration t))
437 :hook (lsp-mode . lsp-ui-mode)
439 (lsp-ui-doc-position 'bottom))
441 (use-package lsp-treemacs
442 :after (lsp treemacs))
447 (add-hook 'c-mode-hook 'lsp)
448 (add-hook 'c++-mode-hook 'lsp)
451 #+begin_src emacs-lisp
452 (add-hook 'c-mode-hook
454 (setq c-default-style "linux"
455 indent-tabs-mode t)))
456 (add-hook 'c-mode-hook 'c-guess)
459 #+begin_src emacs-lisp
460 (use-package editorconfig
463 (editorconfig-mode 1))
466 #+begin_src emacs-lisp
467 ;; (use-package compiler-explorer
468 ;; :commands (compiler-explorer))
471 #+begin_src emacs-lisp
472 (add-to-list 'exec-path "~/.cargo/bin")
474 (use-package rust-mode
479 :bind (:map rustic-mode-map
480 ("C-c r" . rustic-cargo-run)
481 ("C-c b" . rustic-cargo-build)
482 ("C-c t" . rustic-cargo-test)))
487 (add-hook 'rust-mode-hook 'cargo-minor-mode)
488 (add-hook 'toml-mode-hook 'cargo-minor-mode))
491 #+begin_src emacs-lisp
492 (use-package lsp-java
495 (add-hook 'java-mode-hook 'lsp))
498 #+begin_src emacs-lisp
499 (use-package haskell-mode
502 (use-package lsp-haskell
504 (add-hook 'haskell-mode-hook 'lsp)
505 (add-hook 'haskell-mode-hook 'haskell-indent-mode)
506 (add-hook 'haskell-literate-mode-hook 'lsp))
509 #+begin_src emacs-lisp
510 (use-package verilog-mode
515 (make-lsp-client :new-connection (lsp-stdio-connection '("svls"))
516 :major-modes '(verilog-mode)
518 :hook (verilog-mode . (lambda ()
521 (add-to-list 'lsp-language-id-configuration '(verilog-mode . "verilog")))))
524 #+begin_src emacs-lisp
529 ;; :load-path "/usr/local/share/emacs/site-lisp/mu4e/"
531 (setq mu4e-change-filenames-when-moving t
532 mu4e-update-interval (* 10 60)
533 mu4e-get-mail-command "mbsync -a"
534 mu4e-maildir "~/Mail/benni@stuerz.xyz"
535 mu4e-drafts-folder "/Drafts"
536 mu4e-sent-folder "/Sent"
537 mu4e-trash-folder "/Trash"
538 mu4e-maildir-shortcuts