;;; .doom.d/config.el -*- lexical-binding: t; -*- ;; Place your private configuration here ;; ;; Load appearance configuration (load! "+ui") ;; Load custom keybindings (load! "+keybindings") ;; 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 (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 ",") ;; Trigger flycheck after save (setq flycheck-check-syntax-automatically '(save)) ;; Use relative line numbers (Usage: number ) (setq display-line-numbers-type 'relative) ;; 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)) ;; Restore previous session on startup (add-hook 'window-setup-hook #'doom/quickload-session)