;;; .doom.d/config.el -*- lexical-binding: t; -*- ;; Place your private configuration here ;; ;; Load appearance configuration (load! "+ui") ;; Load custom keybindings (load! "+keybindings") ;; Set projects directories (setq projectile-project-search-path '(("~/Projects" . 2) ("~/Documents/Work" . 1) ("~/Documents/Papers" . 0) ("~/Documents/Typesetting" . 1) ("~/Documents/Paperwork" . 1) ("~/Documents/Typesetting" . 1) ("~/Documents/Uni" . 3) ("~/Repos" . 1) "~/.dotfiles" "~/Notes")) ; Auto cleanup recentf (setq recentf-auto-cleanup 300) ; Save backup files to ~/.cache and autosave files to ~/.cache/emacs (setq backup-directory-alist `(("." . "~/.cache")) auto-save-list-file-prefix (concat "~/.cache")) ;; Load org configuration (setq org-directory "~/Notes") (after! org (load! "+org")) ;; Disable completion and line numbers in Markdown (add-hook! 'markdown-mode-hook (display-line-numbers-mode -1)) (after! markdown (set-company-backend! 'markdown-mode nil)) ;; Enable writeroom-mode for text modes (setq writeroom-major-modes '(org-mode markdown-mode) +zen-text-scale 1.5) (add-hook! 'markdown-mode-hook 'global-writeroom-mode) ;; Reload file from disk without confirmation (defun revert-buffer-no-confirm () (interactive) (revert-buffer :ignore-auto :noconfirm)) ;; Align columns in CSV mode (add-hook! 'csv-mode-hook 'csv-align-mode) (add-hook! 'csv-mode-hook 'csv-header-line) ;; Close compilation buffer if successful (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) ;; Map leader key for major mode to , (setq evil-snipe-override-evil-repeat-keys nil) (setq doom-localleader-key ",") ;; Disable company mode in Nix (setq-hook! 'nix-mode-hook company-idle-delay nil) ;; Trigger flycheck after save (setq flycheck-check-syntax-automatically '(save)) ;; 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\\'")) ;; Ignore empty files (after! projectile (add-to-list 'projectile-globally-ignored-files ".gitkeep") (add-to-list 'projectile-globally-ignored-files ".envrc") (add-to-list 'projectile-globally-ignored-files ".project") (add-to-list 'projectile-globally-ignored-directories ".direnv") (add-to-list 'projectile-globally-ignored-directories ".ipynb_checkpoints")) ;; Associate polymode to R markdown files (add-to-list 'auto-mode-alist '("\\.[rR]md\\'" . poly-markdown+R-mode)) ;; Set clangd as C/C++ LSP (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)) ;; Use relative line numbers (Usage: number ) (setq display-line-numbers-type 'relative) ;; 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 wallabag-show-entry-switch 'switch-to-buffer url-automatic-caching t) (add-hook! 'wallabag-after-render-hook 'wallabag-search-update-and-clear-filter)) (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))) ;; Set up elfeed (after! elfeed (setq elfeed-use-curl t) (setq elfeed-protocol-feeds (list (list "fever+https://coolneng@rss.coolneng.duckdns.org" :api-url "https://rss.coolneng.duckdns.org/fever/" :password (auth-source-pass-get 'secret "api/miniflux")))) (setq elfeed-sort-order 'ascending elfeed-search-filter "@all +unread" elfeed-goodies/tag-column-width 0) (elfeed-protocol-enable) (add-hook! 'elfeed-search-mode-hook 'elfeed-update) ;; Use different font and show article in fullscreen (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 "Lato" :height 1.1)) (set-buffer-modified-p nil)))) ;; Set up the mail stack (after! mu4e (load! "+mail")) ;; HACK Enable AOT native compilation (setq native-comp-jit-compilation nil) (after! (doom-packages straight) (setq straight--native-comp-available t)) ;; Use PlatformIO for Arduino development (use-package! platformio-mode :after cc-mode :config (add-hook! 'c++-mode-hook (platformio-conditionally-enable))) ;; Disable Pyright's type checking (after! lsp-pyright (setq lsp-pyright-use-library-code-for-types nil)) ;; Set indentation level to 2 (setq tab-width 2) ;; Move buffer while maintaining cursor centered (use-package! centered-cursor-mode :config (global-centered-cursor-mode)) ;; Enable smooth scrolling (pixel-scroll-precision-mode) ;; Restore previous session on startup (add-hook 'window-setup-hook #'doom/quickload-session)