2026-03-24 02:13:41 +01:00
|
|
|
;; add melpa
|
|
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
|
|
|
|
|
(package-initialize)
|
|
|
|
|
|
|
|
|
|
;; remove menu bar, tool bar, scroll bar
|
2026-03-17 00:58:43 +01:00
|
|
|
(menu-bar-mode 0)
|
|
|
|
|
(tool-bar-mode 0)
|
|
|
|
|
(scroll-bar-mode 0)
|
2026-03-24 02:13:41 +01:00
|
|
|
|
|
|
|
|
;; highlight parens when on them
|
2026-03-17 00:58:43 +01:00
|
|
|
(show-paren-mode 1)
|
2026-03-24 02:13:41 +01:00
|
|
|
|
|
|
|
|
;; better line numbers
|
2026-03-17 00:58:43 +01:00
|
|
|
(global-display-line-numbers-mode)
|
|
|
|
|
(setq display-line-numbers 'relative)
|
|
|
|
|
|
2026-03-24 02:13:41 +01:00
|
|
|
;; y or n instead of yes or no
|
|
|
|
|
(setopt use-short-answers t)
|
|
|
|
|
|
|
|
|
|
;; dynamic loading of file in init dir to put custom
|
|
|
|
|
(setq custom-file (replace-regexp-in-string "/[^/]+$" "/custom.el" user-init-file))
|
|
|
|
|
(load custom-file)
|
|
|
|
|
|
|
|
|
|
;; enable dracula theme
|
|
|
|
|
(use-package dracula-theme :ensure t :config (load-theme 'dracula))
|
|
|
|
|
|
|
|
|
|
;; add time in modeline
|
|
|
|
|
(setopt display-time-format "%a %d %T")
|
|
|
|
|
(setopt display-time-interval 1)
|
|
|
|
|
(display-time-mode)
|
|
|
|
|
;; add column number in modeline
|
|
|
|
|
(column-number-mode 1)
|
|
|
|
|
|
|
|
|
|
;; add which key
|
|
|
|
|
(use-package which-key :ensure t :hook after-init)
|
|
|
|
|
(which-key-mode)
|
|
|
|
|
|
|
|
|
|
;; install and add hook(s) for paredit mode
|
|
|
|
|
(use-package paredit :ensure t :hook after-init)
|
|
|
|
|
|
|
|
|
|
(defun turn-on-paredit ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(paredit-mode))
|
|
|
|
|
|
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'turn-on-paredit)
|
|
|
|
|
|
|
|
|
|
(use-package emacs-everywhere :ensure t :defer t :hook after-init)
|
|
|
|
|
|
|
|
|
|
;; --- from better-defaults ---
|
|
|
|
|
;; ibuffer as default buffer list
|
|
|
|
|
(global-set-key (kbd "C-x C-b") 'ibuffer)
|
|
|
|
|
|
|
|
|
|
;; regex isearches as default
|
|
|
|
|
(global-set-key (kbd "C-s") 'isearch-forward-regexp)
|
|
|
|
|
(global-set-key (kbd "C-r") 'isearch-backward-regexp)
|
|
|
|
|
(global-set-key (kbd "C-M-s") 'isearch-forward)
|
|
|
|
|
(global-set-key (kbd "C-M-r") 'isearch-backward)
|
|
|
|
|
|
|
|
|
|
;; apropos?
|
|
|
|
|
(setq apropos-do-all t)
|
|
|
|
|
|
|
|
|
|
;; ignore case for file name, buffer name, competion
|
|
|
|
|
(setq read-file-name-completion-ignore-case t)
|
|
|
|
|
(setq read-buffer-completion-ignore-case t)
|
|
|
|
|
(setq completion-ignore-case t)
|
|
|
|
|
|
|
|
|
|
;; --- from emacs bedrock ---
|
|
|
|
|
|
|
|
|
|
;; Automatically reread from disk if the underlying file changes
|
|
|
|
|
(setopt auto-revert-avoid-polling t)
|
|
|
|
|
;; Some systems don't do file notifications well; see
|
|
|
|
|
;; https://todo.sr.ht/~ashton314/emacs-bedrock/11
|
|
|
|
|
(setopt auto-revert-interval 5)
|
|
|
|
|
(setopt auto-revert-check-vc-info t)
|
|
|
|
|
(global-auto-revert-mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Move through windows with Ctrl-<arrow keys>
|
|
|
|
|
(windmove-default-keybindings 'control) ; You can use other modifiers here
|
|
|
|
|
|
|
|
|
|
;; Fix archaic defaults
|
|
|
|
|
(setopt sentence-end-double-space nil)
|
|
|
|
|
|
|
|
|
|
;; magit <3
|
|
|
|
|
(use-package magit
|
|
|
|
|
:ensure t
|
|
|
|
|
:bind (("C-x g" . magit-status)))
|
|
|
|
|
|
|
|
|
|
;; (add-hook 'prog-mode 'electric-pair-mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; completion stuff
|
|
|
|
|
|
|
|
|
|
;; Vertico: better vertical completion for minibuffer commands
|
|
|
|
|
(use-package vertico
|
|
|
|
|
:ensure t
|
|
|
|
|
:init
|
|
|
|
|
;; You'll want to make sure that e.g. fido-mode isn't enabled
|
|
|
|
|
(vertico-mode))
|
|
|
|
|
|
|
|
|
|
(use-package vertico-directory
|
|
|
|
|
:ensure nil
|
|
|
|
|
:after vertico
|
|
|
|
|
:bind (:map vertico-map
|
|
|
|
|
("M-DEL" . vertico-directory-delete-word)))
|
|
|
|
|
|
|
|
|
|
(use-package consult
|
|
|
|
|
:ensure t
|
|
|
|
|
:bind (
|
|
|
|
|
;; Drop-in replacements
|
|
|
|
|
("C-x b" . consult-buffer) ; orig. switch-to-buffer
|
|
|
|
|
("M-y" . consult-yank-pop) ; orig. yank-pop
|
|
|
|
|
;; Searching
|
|
|
|
|
("M-s r" . consult-ripgrep)
|
|
|
|
|
("M-s l" . consult-line) ; Alternative: rebind C-s to use
|
|
|
|
|
("M-s s" . consult-line) ; consult-line instead of isearch, bind
|
|
|
|
|
("M-s L" . consult-line-multi) ; isearch to M-s s
|
|
|
|
|
("M-s o" . consult-outline)
|
|
|
|
|
;; Isearch integration
|
|
|
|
|
:map isearch-mode-map
|
|
|
|
|
("M-e" . consult-isearch-history) ; orig. isearch-edit-string
|
|
|
|
|
("M-s e" . consult-isearch-history) ; orig. isearch-edit-string
|
|
|
|
|
("M-s l" . consult-line) ; needed by consult-line to detect isearch
|
|
|
|
|
("M-s L" . consult-line-multi) ; needed by consult-line to detect isearch
|
|
|
|
|
)
|
|
|
|
|
:config
|
|
|
|
|
;; Narrowing lets you restrict results to certain groups of candidates
|
|
|
|
|
(setq consult-narrow-key "<"))
|
|
|
|
|
|
|
|
|
|
;; Vertico: better vertical completion for minibuffer commands
|
|
|
|
|
(use-package vertico
|
|
|
|
|
:ensure t
|
|
|
|
|
:init
|
|
|
|
|
;; You'll want to make sure that e.g. fido-mode isn't enabled
|
|
|
|
|
(vertico-mode))
|
|
|
|
|
|
|
|
|
|
(use-package vertico-directory
|
|
|
|
|
:ensure nil
|
|
|
|
|
:after vertico
|
|
|
|
|
:bind (:map vertico-map
|
|
|
|
|
("M-DEL" . vertico-directory-delete-word)))
|
|
|
|
|
|
|
|
|
|
;; Marginalia: annotations for minibuffer
|
|
|
|
|
(use-package marginalia
|
|
|
|
|
:ensure t
|
|
|
|
|
:config
|
|
|
|
|
(marginalia-mode))
|
|
|
|
|
|
|
|
|
|
;; Corfu: Popup completion-at-point
|
|
|
|
|
(use-package corfu
|
|
|
|
|
:ensure t
|
|
|
|
|
:init
|
|
|
|
|
(global-corfu-mode)
|
|
|
|
|
:bind
|
|
|
|
|
(:map corfu-map
|
|
|
|
|
("SPC" . corfu-insert-separator)
|
|
|
|
|
("C-n" . corfu-next)
|
|
|
|
|
("C-p" . corfu-previous)))
|
|
|
|
|
|
|
|
|
|
;; Part of corfu
|
|
|
|
|
(use-package corfu-popupinfo
|
|
|
|
|
:after corfu
|
|
|
|
|
:ensure nil
|
|
|
|
|
:hook (corfu-mode . corfu-popupinfo-mode)
|
|
|
|
|
:custom
|
|
|
|
|
(corfu-popupinfo-delay '(0.25 . 0.1))
|
|
|
|
|
(corfu-popupinfo-hide nil)
|
|
|
|
|
:config
|
|
|
|
|
(corfu-popupinfo-mode))
|
|
|
|
|
|
|
|
|
|
;; Make corfu popup come up in terminal overlay
|
|
|
|
|
(use-package corfu-terminal
|
|
|
|
|
:if (not (display-graphic-p))
|
|
|
|
|
:ensure t
|
|
|
|
|
:config
|
|
|
|
|
(corfu-terminal-mode))
|
|
|
|
|
|
|
|
|
|
;; Fancy completion-at-point functions; there's too much in the cape package to
|
|
|
|
|
;; configure here; dive in when you're comfortable!
|
|
|
|
|
(use-package cape
|
|
|
|
|
:ensure t
|
|
|
|
|
:init
|
|
|
|
|
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
|
|
|
|
(add-to-list 'completion-at-point-functions #'cape-file))
|
|
|
|
|
|
|
|
|
|
;; Pretty icons for corfu
|
|
|
|
|
(use-package kind-icon
|
|
|
|
|
:if (display-graphic-p)
|
|
|
|
|
:ensure t
|
|
|
|
|
:after corfu
|
|
|
|
|
:config
|
|
|
|
|
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
|
|
|
|
|
|
|
|
|
|
;; Orderless: powerful completion style
|
|
|
|
|
(use-package orderless
|
|
|
|
|
:ensure t
|
|
|
|
|
:config
|
|
|
|
|
(setq completion-styles '(orderless)))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; highlight todo
|
|
|
|
|
(use-package hl-todo :ensure t :defer t :hook (prog-mode . hl-todo-mode))
|
|
|
|
|
|
|
|
|
|
(setq hl-todo-keyword-faces
|
|
|
|
|
'(("TODO" . "#FF0000")
|
|
|
|
|
("FIXME" . "#FF0000")
|
|
|
|
|
("DEBUG" . "#A020F0")
|
|
|
|
|
("GOTCHA" . "#FF4500")
|
|
|
|
|
("STUB" . "#1E90FF")))
|
|
|
|
|
(add-hook 'after-init-hook 'hl-todo-mode)
|
|
|
|
|
|
|
|
|
|
;; with magit
|
|
|
|
|
(with-eval-after-load 'magit
|
|
|
|
|
(add-hook 'magit-log-wash-summary-hook
|
|
|
|
|
#'hl-todo-search-and-highlight t)
|
|
|
|
|
(add-hook 'magit-revision-wash-message-hook
|
|
|
|
|
#'hl-todo-search-and-highlight t))
|
|
|
|
|
|
|
|
|
|
;; make color codes be highlighted in their color
|
|
|
|
|
(use-package rainbow-mode :ensure t :defer t :hook (prog-mode . rainbow-mode))
|
|
|
|
|
(add-hook 'after-init-hook 'rainbow-mode)
|
|
|
|
|
|
|
|
|
|
|
2026-03-25 02:47:20 +01:00
|
|
|
;; TODO add fast rudimentary spell check
|
|
|
|
|
;; leaving this in for now, maybe i could add fast rudimentary spell checking and then use languagetool for slower more thorough spell checks
|
2026-03-24 02:13:41 +01:00
|
|
|
;; doesnt work yet?
|
|
|
|
|
;; it should only do these when ispell is loaded
|
|
|
|
|
;; idk
|
|
|
|
|
;; (eval-after-load "ispell"
|
|
|
|
|
;; '(progn
|
|
|
|
|
;; (setq ispell-really-hunspell)
|
|
|
|
|
;; (setq ispell-program-name "hunspell")
|
|
|
|
|
;; (setq ispell-dictionary "en_US,de_DE")
|
|
|
|
|
;; (ispell-set-spellchecker-params)
|
|
|
|
|
;; (ispell-hunspell-add-multi-dic "en_US,de_DE")))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-25 02:47:20 +01:00
|
|
|
;; TODO do we need flycheck anymore?
|
|
|
|
|
;; i don't think so?
|
|
|
|
|
;; (use-package flycheck :ensure t :defer t :hook after-init)
|
2026-03-24 02:13:41 +01:00
|
|
|
;; (use-package flycheck-languagetool
|
|
|
|
|
;; :ensure t
|
|
|
|
|
;; :hook (text-mode . flycheck-languagetool-setup)
|
|
|
|
|
;; :init
|
|
|
|
|
;; (setq flycheck-languagetool-server-jar "~/.languagetool-server.jar"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(use-package company :ensure t :defer t :hook after-init)
|
|
|
|
|
(add-hook 'after-init-hook 'global-company-mode)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; multiple cursors
|
|
|
|
|
(use-package multiple-cursors
|
|
|
|
|
:ensure t
|
|
|
|
|
:defer t
|
|
|
|
|
:hook after-init
|
|
|
|
|
:bind (
|
|
|
|
|
( "C-S-c" . mc/edit-lines)
|
|
|
|
|
( "C->" . mc/mark-next-like-this)
|
|
|
|
|
( "C-<" . mc/mark-previous-like-this)
|
|
|
|
|
( "C-c C-<" . mc/mark-all-like-this)
|
2026-03-25 02:47:20 +01:00
|
|
|
( "C-^\"" . mc/skip-to-next-like-this)
|
2026-03-24 02:13:41 +01:00
|
|
|
( "C-:" . mc/skip-to-previous-like-this)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; make emacs remember last session
|
|
|
|
|
(setq save-place-file (concat user-emacs-directory ".saveplace"))
|
|
|
|
|
;; (setq desktop-dirname (concat user-emacs-directory ".desktop.d"))
|
|
|
|
|
;; (setq-default save-place t)
|
|
|
|
|
;; (require 'saveplace)
|
|
|
|
|
(save-place-mode 1)
|
|
|
|
|
(desktop-save-mode 1)
|
|
|
|
|
|
|
|
|
|
(setq recentf-save-file (concat user-emacs-directory ".recentf"))
|
|
|
|
|
;; Save history of minibuffer
|
|
|
|
|
(savehist-mode)
|
|
|
|
|
(setq savehist-file (concat user-emacs-directory ".history"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Helpful resources:
|
|
|
|
|
;;
|
|
|
|
|
;; - https://www.masteringemacs.org/article/seamlessly-merge-multiple-documentation-sources-eldoc
|
2026-03-17 17:29:20 +01:00
|
|
|
|
2026-03-24 02:13:41 +01:00
|
|
|
(use-package eglot
|
|
|
|
|
;; no :ensure t here because it's built-in
|
|
|
|
|
;; Configure hooks to automatically turn-on eglot for selected modes
|
|
|
|
|
; :hook
|
|
|
|
|
; (((python-mode ruby-mode elixir-mode) . eglot-ensure))
|
|
|
|
|
:custom
|
|
|
|
|
(eglot-send-changes-idle-time 0.1)
|
|
|
|
|
(eglot-extend-to-xref t) ; activate Eglot in referenced non-project files
|
|
|
|
|
:config
|
|
|
|
|
(fset #'jsonrpc--log-event #'ignore) ; massive perf boost---don't log every event
|
|
|
|
|
;; Sometimes you need to tell Eglot where to find the language server
|
|
|
|
|
; (add-to-list 'eglot-server-programs
|
|
|
|
|
; '(haskell-mode . ("haskell-language-server-wrapper" "--lsp")))
|
|
|
|
|
)
|
2026-03-17 17:29:20 +01:00
|
|
|
|
2026-03-25 02:47:20 +01:00
|
|
|
;; spell checking with languagetool, slow but thorough
|
|
|
|
|
;; dowloaded:
|
|
|
|
|
;; https://languagetool.org/download/ngram-data/ngrams-de-20150819.zip
|
|
|
|
|
;; https://languagetool.org/download/ngram-data/ngrams-en-20150817.zip
|
|
|
|
|
;; https://languagetool.org/download/LanguageTool-stable.zip
|
|
|
|
|
;; and put them in a directory like this
|
|
|
|
|
;; emacs-init-dir/.languagetool/contents of LanguageTool-stable.zip like languagetool-server
|
|
|
|
|
;; emacs-init-dir/.languagetool/contents of ngram.* like de or en
|
|
|
|
|
(use-package languagetool
|
|
|
|
|
:ensure t
|
|
|
|
|
:defer t
|
|
|
|
|
:commands (languagetool-check
|
|
|
|
|
languagetool-clear-suggestions
|
|
|
|
|
languagetool-correct-at-point
|
|
|
|
|
languagetool-correct-buffer
|
|
|
|
|
languagetool-set-language
|
|
|
|
|
languagetool-server-mode
|
|
|
|
|
languagetool-server-start
|
|
|
|
|
languagetool-server-stop)
|
|
|
|
|
:config (setq languagetool-java-arguments (list "-Dfile.encoding=UTF-8" (concat "--languagemodel " (concat user-emacs-directory ".languagetool/ngram-data")))
|
|
|
|
|
languagetool-console-command (concat user-emacs-directory (concat ".languagetool/languagetool-commandline.jar"))
|
|
|
|
|
languagetool-console-arguments (list (concat user-emacs-directory "--languagemodel") " .languagetool/ngram-data")
|
|
|
|
|
languagetool-server-command (concat user-emacs-directory (concat ".languagetool/languagetool-server.jar"))
|
|
|
|
|
languagetool-server-arguments (list (concat user-emacs-directory "--languageModel") " .languagetool/ngram-data")
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
;; TODO make languagetool languagte toggle function
|
|
|
|
|
;; defun my/languagetool-toggle-language
|
|
|
|
|
;; switch between auto, en, de
|
|
|
|
|
;; have it be auto or de by default and then switch either to en or to de
|
|
|
|
|
;; like auto -> de
|
|
|
|
|
;; or de -> en
|
|
|
|
|
;; or maybe just like that
|
|
|
|
|
;; first auto then de then en
|
|
|
|
|
;; TODO evaluate how i wanna do this
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; (with-eval-after-load 'eglot
|
|
|
|
|
;; (add-to-list 'eglot-server-programs
|
|
|
|
|
;; '(text-mode . ("harper-ls" "--stdio"))
|
|
|
|
|
;; '(markdown-mode . ("harper-ls" "--stdio"))
|
|
|
|
|
;; ))
|
2026-03-17 00:58:43 +01:00
|
|
|
|
2026-03-24 02:13:41 +01:00
|
|
|
;; flycheck told me to do this:
|
|
|
|
|
(provide 'init)
|
|
|
|
|
;;; init.el ends here
|