2019-12-03 23:21:32 +01:00
|
|
|
;;; .doom.d/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;; Place your private configuration here
|
2019-12-04 04:42:19 +01:00
|
|
|
;;
|
2020-01-06 10:20:20 +01:00
|
|
|
;; Load appearance configuration
|
|
|
|
(load! "+ui")
|
2022-09-24 23:15:25 +02:00
|
|
|
;; Load custom keybindings
|
|
|
|
(load! "+keybindings")
|
2019-12-04 04:43:02 +01:00
|
|
|
;; Set projects directories
|
2021-11-09 16:31:18 +01:00
|
|
|
(setq projectile-project-search-path '(("~/Projects" . 2)
|
2021-11-23 12:34:49 +01:00
|
|
|
("~/Documents/Work" . 1)
|
|
|
|
("~/Documents/Papers" . 0)
|
|
|
|
("~/Documents/Typesetting" . 1)
|
|
|
|
("~/Documents/Paperwork" . 1)
|
|
|
|
("~/Documents/Typesetting" . 1)
|
2021-11-09 16:31:18 +01:00
|
|
|
("~/Documents/Uni" . 3)
|
2021-11-23 12:34:49 +01:00
|
|
|
("~/Repos" . 1)
|
2022-09-18 20:12:58 +02:00
|
|
|
"~/.dotfiles"
|
|
|
|
"~/Notes"))
|
|
|
|
; Auto cleanup recentf
|
2020-06-20 02:08:47 +02:00
|
|
|
(setq recentf-auto-cleanup 300)
|
2022-09-18 20:12:58 +02:00
|
|
|
; Save backup files to ~/.cache and autosave files to ~/.cache/emacs
|
2019-12-16 20:08:37 +01:00
|
|
|
(setq backup-directory-alist `(("." . "~/.cache"))
|
2021-09-07 13:31:05 +02:00
|
|
|
auto-save-list-file-prefix (concat "~/.cache"))
|
2019-12-07 20:16:04 +01:00
|
|
|
;; Load org configuration
|
2022-09-11 20:57:45 +02:00
|
|
|
(setq org-directory "~/Notes")
|
2019-12-07 20:16:04 +01:00
|
|
|
(after! org (load! "+org"))
|
2022-03-11 11:54:01 +01:00
|
|
|
;; Disable completion and line numbers in Markdown
|
2023-03-23 02:54:41 +01:00
|
|
|
(add-hook! 'markdown-mode-hook (display-line-numbers-mode -1))
|
2019-12-31 05:56:59 +01:00
|
|
|
(after! markdown
|
2022-03-11 11:54:01 +01:00
|
|
|
(set-company-backend! 'markdown-mode nil))
|
2019-12-07 20:17:29 +01:00
|
|
|
;; Reload file from disk without confirmation
|
|
|
|
(defun revert-buffer-no-confirm ()
|
|
|
|
(interactive)
|
|
|
|
(revert-buffer :ignore-auto :noconfirm))
|
2020-01-06 10:20:20 +01:00
|
|
|
;; Align columns in CSV mode
|
2023-03-23 02:54:41 +01:00
|
|
|
(add-hook! 'csv-mode-hook 'csv-align-mode)
|
|
|
|
(add-hook! 'csv-mode-hook 'csv-header-line)
|
2020-02-23 14:10:38 +01:00
|
|
|
;; Close compilation buffer if successful
|
2023-07-31 20:46:21 +02:00
|
|
|
(defun close-compilation-buffer-if-successful (buffer string)
|
|
|
|
"Bury a compilation buffer if succeeded without warnings "
|
|
|
|
(when (and (eq major-mode 'compilation-mode)
|
|
|
|
(string-match "finished" string)
|
|
|
|
(not
|
|
|
|
(with-current-buffer buffer
|
|
|
|
(search-forward "warning" nil t))))
|
|
|
|
(run-with-timer 1 nil
|
|
|
|
(lambda (buf)
|
|
|
|
(let ((window (get-buffer-window buf)))
|
|
|
|
(when (and (window-live-p window)
|
|
|
|
(eq buf (window-buffer window)))
|
|
|
|
(delete-window window))))
|
|
|
|
buffer)))
|
|
|
|
(add-hook 'compilation-finish-functions #'close-compilation-buffer-if-successful)
|
2020-07-10 00:02:43 +02:00
|
|
|
;; Map leader key for major mode to ,
|
2023-04-10 22:37:39 +02:00
|
|
|
(setq evil-snipe-override-evil-repeat-keys nil)
|
2020-07-10 00:02:43 +02:00
|
|
|
(setq doom-localleader-key ",")
|
2020-10-06 01:48:18 +02:00
|
|
|
;; Disable company mode in Nix
|
|
|
|
(setq-hook! 'nix-mode-hook company-idle-delay nil)
|
2021-01-12 23:01:41 +01:00
|
|
|
;; Trigger flycheck after save
|
|
|
|
(setq flycheck-check-syntax-automatically '(save))
|
2021-02-10 01:31:24 +01:00
|
|
|
;; Ignore development databases folders
|
|
|
|
(after! lsp-mode
|
|
|
|
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.mysql\\'")
|
|
|
|
(add-to-list 'lsp-file-watch-ignored-directories "[/\\\\]\\.pgdata\\'"))
|
2021-03-23 23:52:27 +01:00
|
|
|
;; Ignore empty files
|
2021-04-01 16:42:22 +02:00
|
|
|
(after! projectile
|
2021-10-19 10:16:11 +02:00
|
|
|
(add-to-list 'projectile-globally-ignored-files ".gitkeep")
|
2022-10-02 22:50:09 +02:00
|
|
|
(add-to-list 'projectile-globally-ignored-files ".envrc")
|
|
|
|
(add-to-list 'projectile-globally-ignored-files ".project")
|
2022-10-10 08:56:26 +02:00
|
|
|
(add-to-list 'projectile-globally-ignored-directories ".direnv")
|
|
|
|
(add-to-list 'projectile-globally-ignored-directories ".ipynb_checkpoints"))
|
2021-10-18 17:19:44 +02:00
|
|
|
;; Associate polymode to R markdown files
|
|
|
|
(add-to-list 'auto-mode-alist '("\\.[rR]md\\'" . poly-markdown+R-mode))
|
2021-10-20 10:42:07 +02:00
|
|
|
;; Set clangd as C/C++ LSP
|
2022-12-18 01:04:16 +01:00
|
|
|
(setq lsp-clients-clangd-args '("-j=3"
|
|
|
|
"--background-index"
|
|
|
|
"--clang-tidy"
|
|
|
|
"--completion-style=detailed"
|
|
|
|
"--header-insertion=never"
|
|
|
|
"--header-insertion-decorators=0"))
|
|
|
|
(after! lsp-clangd (set-lsp-priority! 'clangd 2))
|
2022-05-08 16:06:46 +02:00
|
|
|
;; Use relative line numbers (Usage: number <j/k>)
|
|
|
|
(setq display-line-numbers-type 'relative)
|
2022-08-13 14:47:42 +02:00
|
|
|
;; Use pass as auth-source
|
|
|
|
(add-to-list 'auth-sources 'password-store)
|
|
|
|
;; Set up wallabag
|
|
|
|
(after! wallabag
|
|
|
|
(setq wallabag-host "https://wallabag.coolneng.duckdns.org"
|
|
|
|
wallabag-username "coolneng"
|
|
|
|
wallabag-password (auth-source-pass-get 'secret "api/wallabag")
|
|
|
|
wallabag-clientid (auth-source-pass-get "clientid" "api/wallabag")
|
|
|
|
wallabag-secret (auth-source-pass-get "api-secret" "api/wallabag")
|
|
|
|
wallabag-show-sidebar 't
|
2022-09-12 01:53:41 +02:00
|
|
|
wallabag-show-entry-switch 'switch-to-buffer
|
|
|
|
url-automatic-caching t)
|
2023-03-23 02:54:41 +01:00
|
|
|
(add-hook! 'wallabag-after-render-hook 'wallabag-search-update-and-clear-filter))
|
2022-09-18 19:03:52 +02:00
|
|
|
(add-hook! 'doom-real-buffer-functions
|
|
|
|
(defun +rss-buffer-p (buf)
|
|
|
|
(string-match-p "^\\*wallabag" (buffer-name buf))))
|
|
|
|
(defvar +wallabag-workspace-name "*wallabag*")
|
|
|
|
(defun =wallabag ()
|
|
|
|
"Activate (or switch to) `wallabag' in its workspace."
|
|
|
|
(interactive)
|
|
|
|
(if (modulep! :ui workspaces)
|
|
|
|
(progn
|
|
|
|
(+workspace-switch +wallabag-workspace-name t)
|
|
|
|
(doom/switch-to-scratch-buffer)
|
|
|
|
(wallabag)
|
|
|
|
(+workspace/display))
|
|
|
|
(setq +wallabag--wconf (current-window-configuration))
|
|
|
|
(delete-other-windows)
|
|
|
|
(switch-to-buffer (doom-fallback-buffer))
|
|
|
|
(wallabag)))
|
2022-08-15 18:03:18 +02:00
|
|
|
;; Set up elfeed
|
|
|
|
(after! elfeed
|
|
|
|
(setq elfeed-use-curl t)
|
|
|
|
(setq elfeed-feeds (list
|
2022-09-18 19:04:26 +02:00
|
|
|
(list "fever+https://coolneng@rss.coolneng.duckdns.org"
|
|
|
|
:api-url "https://rss.coolneng.duckdns.org/fever/"
|
|
|
|
:password (auth-source-pass-get 'secret "api/miniflux"))))
|
2022-08-15 18:03:18 +02:00
|
|
|
(setq elfeed-sort-order 'ascending
|
2022-09-05 15:30:59 +02:00
|
|
|
elfeed-search-filter "@all +unread"
|
|
|
|
elfeed-goodies/tag-column-width 0)
|
2022-08-15 18:03:18 +02:00
|
|
|
(elfeed-protocol-enable)
|
2023-02-23 00:02:15 +01:00
|
|
|
(add-hook! 'elfeed-search-mode-hook 'elfeed-update)
|
|
|
|
;; Use different font and show article in fullscreen
|
2023-05-15 05:15:28 +02:00
|
|
|
(setq elfeed-show-entry-switch #'switch-to-buffer)
|
|
|
|
(defadvice! +rss-elfeed-wrap-h-nicer ()
|
|
|
|
"Enhances an elfeed entry's readability by wrapping it to a width of
|
|
|
|
`fill-column' and centering it with `visual-fill-column-mode'."
|
|
|
|
:override #'+rss-elfeed-wrap-h
|
|
|
|
(setq-local truncate-lines nil
|
|
|
|
shr-width 160
|
|
|
|
visual-fill-column-center-text t
|
|
|
|
default-text-properties '(line-height 1.1))
|
|
|
|
(let ((inhibit-read-only t)
|
|
|
|
(inhibit-modification-hooks t))
|
|
|
|
(visual-fill-column-mode)
|
|
|
|
(setq-local shr-current-font '(:family "Raleway" :height 1.1))
|
|
|
|
(set-buffer-modified-p nil))))
|
2022-09-18 20:25:59 +02:00
|
|
|
;; Set up the mail stack
|
|
|
|
(after! mu4e (load! "+mail"))
|
2022-10-01 00:54:27 +02:00
|
|
|
;; HACK Enable AOT native compilation
|
|
|
|
(setq native-comp-deferred-compilation nil)
|
|
|
|
(after! (doom-packages straight)
|
|
|
|
(setq straight--native-comp-available t))
|
2023-03-15 01:31:12 +01:00
|
|
|
;; Use PlatformIO for Arduino development
|
|
|
|
(use-package! platformio-mode
|
|
|
|
:after cc-mode
|
|
|
|
:config
|
|
|
|
(add-hook! 'c++-mode-hook (platformio-conditionally-enable)))
|
2023-03-25 02:35:42 +01:00
|
|
|
;; Disable Pyright's type checking
|
|
|
|
(after! lsp-pyright
|
|
|
|
(setq lsp-pyright-use-library-code-for-types nil))
|
2023-04-27 18:50:59 +02:00
|
|
|
;; Set indentation level to 2
|
|
|
|
(setq tab-width 2)
|
2023-05-23 10:53:02 +02:00
|
|
|
;; Move buffer while maintaining cursor centered
|
|
|
|
(use-package! centered-cursor-mode
|
|
|
|
:config
|
|
|
|
(global-centered-cursor-mode))
|
2023-07-31 20:47:34 +02:00
|
|
|
;; Enable smooth scrolling
|
|
|
|
(pixel-scroll-precision-mode)
|