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")
|
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)
|
2021-11-09 16:31:18 +01:00
|
|
|
"~/.dotfiles"))
|
2019-12-04 04:43:02 +01:00
|
|
|
; Auto cleanup recentf
|
2020-06-20 02:08:47 +02:00
|
|
|
(setq recentf-auto-cleanup 300)
|
2019-12-04 04:43:02 +01: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
|
|
|
|
(after! org (load! "+org"))
|
2020-01-26 14:06:00 +01:00
|
|
|
;; Enter writeroom and disable completion and line numbers in Markdown
|
2020-05-24 08:15:14 +02:00
|
|
|
(add-hook 'markdown-mode-hook (lambda () (display-line-numbers-mode -1)))
|
2019-12-31 05:56:59 +01:00
|
|
|
(after! markdown
|
2020-01-26 14:06:00 +01:00
|
|
|
(set-company-backend! 'markdown-mode nil)
|
|
|
|
(add-hook 'markdown-mode-hook 'global-writeroom-mode))
|
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))
|
2019-12-16 20:08:37 +01:00
|
|
|
;; Select target in Makefile compilation as default
|
|
|
|
(map! :leader :n "c c" #'makefile-executor-execute-project-target)
|
2020-01-06 10:20:20 +01:00
|
|
|
;; Align columns in CSV mode
|
|
|
|
(add-hook 'csv-mode-hook 'csv-align-mode)
|
2020-02-23 14:10:38 +01:00
|
|
|
;; Close compilation buffer if successful
|
2020-01-23 14:49:15 +01:00
|
|
|
(setq compilation-finish-functions
|
|
|
|
(lambda (buf str)
|
|
|
|
(if (null (string-match ".*exited abnormally.*" str))
|
|
|
|
(progn
|
|
|
|
(run-at-time
|
|
|
|
"0.5 sec" nil 'delete-windows-on
|
|
|
|
(get-buffer-create "*compilation*"))
|
|
|
|
(message "No Compilation Errors!")))))
|
2020-01-26 14:06:00 +01:00
|
|
|
;; Enable writeroom for text modes
|
|
|
|
(setq writeroom-major-modes '(markdown-mode org-mode))
|
2020-07-10 00:02:43 +02:00
|
|
|
;; Map leader key for major mode to ,
|
|
|
|
(setq doom-localleader-key ",")
|
2020-09-02 18:32:17 +02:00
|
|
|
;; Show matching parenthesis on the minibuffer
|
|
|
|
(after! smartparens (show-smartparens-global-mode t))
|
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")
|
|
|
|
(add-to-list 'projectile-globally-ignored-directories ".direnv"))
|
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))
|
|
|
|
;; Keybindings for R markdown polymode
|
|
|
|
(map! :map poly-markdown+R-mode-map
|
|
|
|
:n "RET" #'polymode-eval-chunk
|
|
|
|
:desc "Evaluate code block")
|
2021-10-20 10:42:07 +02:00
|
|
|
;; 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))
|
2021-12-07 11:06:27 +01:00
|
|
|
;; HACK Workaround for Emacs 29
|
|
|
|
(general-auto-unbind-keys :off)
|
|
|
|
(remove-hook 'doom-after-init-modules-hook #'general-auto-unbind-keys)
|