doom.d/config.el

62 lines
2.4 KiB
EmacsLisp
Raw Permalink Normal View History

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")
2023-10-04 19:11:11 +02:00
;; Auto cleanup recentf
2020-06-20 02:08:47 +02:00
(setq recentf-auto-cleanup 300)
2023-10-04 19:11:11 +02:00
;; Save backup files to ~/.cache and autosave files to ~/.cache/emacs
(setq backup-directory-alist `(("." . "~/.cache"))
2021-09-07 13:31:05 +02:00
auto-save-list-file-prefix (concat "~/.cache"))
;; Load org configuration
(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))
(after! markdown
2022-03-11 11:54:01 +01:00
(set-company-backend! 'markdown-mode nil))
2023-09-19 23:42:52 +02:00
;; 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))
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)
;; 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)
2020-07-10 00:02:43 +02:00
;; Map leader key for major mode to ,
(setq evil-snipe-override-evil-repeat-keys nil)
2020-07-10 00:02:43 +02:00
(setq doom-localleader-key ",")
;; Trigger flycheck after save
(setq flycheck-check-syntax-automatically '(save))
2022-05-08 16:06:46 +02:00
;; Use relative line numbers (Usage: number <j/k>)
(setq display-line-numbers-type 'relative)
2023-04-27 18:50:59 +02:00
;; 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))
2023-08-27 07:44:27 +02:00
;; Restore previous session on startup
(add-hook 'window-setup-hook #'doom/quickload-session)