114 lines
4.7 KiB
EmacsLisp
114 lines
4.7 KiB
EmacsLisp
;;; .doom.d/config.el -*- lexical-binding: t; -*-
|
|
|
|
;; Place your private configuration here
|
|
;;
|
|
;; Load appearance configuration
|
|
(load! "+ui")
|
|
;; 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"))
|
|
; 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 (lambda () (display-line-numbers-mode -1)))
|
|
(after! markdown
|
|
(set-company-backend! 'markdown-mode nil))
|
|
;; Reload file from disk without confirmation
|
|
(defun revert-buffer-no-confirm ()
|
|
(interactive)
|
|
(revert-buffer :ignore-auto :noconfirm))
|
|
;; Select target in Makefile compilation as default
|
|
(map! :leader :n "c c" #'makefile-executor-execute-project-target)
|
|
;; Align columns in CSV mode
|
|
(add-hook 'csv-mode-hook 'csv-align-mode)
|
|
;; Close compilation buffer if successful
|
|
(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!")))))
|
|
;; Map leader key for major mode to ,
|
|
(setq doom-localleader-key ",")
|
|
;; Show matching parenthesis on the minibuffer
|
|
(after! smartparens (show-smartparens-global-mode t))
|
|
;; 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-directories ".direnv"))
|
|
;; 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")
|
|
;; 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 <j/k>)
|
|
(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)
|
|
(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))))
|
|
;; Set up elfeed
|
|
(after! elfeed
|
|
(setq elfeed-use-curl t)
|
|
(setq elfeed-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 delta to view diffs in Magit
|
|
(use-package! magit-delta
|
|
:after magit
|
|
:preface
|
|
(setq
|
|
magit-delta-default-dark-theme "Nord"
|
|
magit-delta-default-light-theme "OneHalfLight")
|
|
:config
|
|
(magit-delta-mode))
|