dot-doom/config.el

258 lines
8.4 KiB
EmacsLisp

;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file temp+bindingslates and snippets. It is optional.
(setq user-full-name "Matt Nish-Lapidus"
user-mail-address "matt@emenel.ca")
;; See 'C-h v doom-font' for documentation and more examples of what they
;; accept. For example:
(setq doom-font (font-spec :family "JetBrains Mono" :size 19))
(setq fancy-splash-image (concat doom-user-dir "splash.png"))
(setq doom-theme 'doom-one)
(setq +doom-dashboard-pwd-policy nil)
;; Must be used *after* the theme is loaded
(custom-set-faces
'(default ((t (:background "#111111"))))
'(hl-line ((t (:background "#222222"))))
;; '(solair-default-face ((t (:background "#111111"))))
'(cursor ((t (:background "#FCFCFA" :foreground "black"))))
'(line-number ((t (:foreground "#424242"))))
'(mu4e-highlight-face ((t (:inherit nil :background "gray26" :foreground "gray85")))))
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq display-line-numbers-type 'relative)
(setq scroll-preserve-screen-position t)
(setq global-hl-line-modes nil)
(if (daemonp)
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(scroll-bar-mode -1))))
(scroll-bar-mode -1))
(setq locale-coding-system 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq org-directory "~/Documents/Obsidian/Primary")
(use-package! kbd-mode :defer t)
(use-package! direnv
:config
(direnv-mode))
;; Modeline
;; - add current workspace name
;; - add major mode icon
(after! doom-modeline
(setq doom-modeline-persp-name t
doom-modeline-major-mode-icon t)
(setq doom-modeline-total-line-number t))
(defun +default/insert-snippet ()
(interactive)
(cond ((modulep! :completion vertico)
(call-interactively #'consult-yasnippet))
(t (call-interactively #'yas-insert-snippet))))
;; some global settings
(setq shell-file-name (executable-find "bash"))
(setq dired-vc-rename-file t) ; renaming and changing files in dired now integrates with magit
(after! vterm
(setq-default vterm-shell (executable-find "fish"))
(setq-default explicit-shell-file-name (executable-find "fish"))
(setq vterm-kill-buffer-on-exit t)
(after! meow
(meow-vterm-enable)))
;; remove org agenda from the splash screen
(assoc-delete-all "Open org-agenda" +doom-dashboard-menu-sections)
;; reduce which-key waiting
(after! which-key
(setq which-key-idle-delay 0.3))
;; some defaults for cursor size, scrolling, and buffer handling
(setq x-stretch-cursor t
kill-buffer-delete-auto-save-files t
scroll-conservatively 0)
(setq-default tab-width 2)
(after! treemacs
(setq treemacs-follow-mode t)
(setq treemacs-project-follow-mode t))
(after! anzu
(global-anzu-mode))
(global-so-long-mode 1)
(after! parinfer-rust-mode
(setq parinfer-rust-auto-download nil)
(setq parinfer-rust-preferred-mode "smart"))
(setq dap-ui-variable-length 200)
;; smart tabs set modes
(after! smart-tabs-mode
(smart-tabs-insinuate 'c 'javascript 'python))
;; Add consult-line searches to isearch history (both regular and regex) -- can now use meow 'n' to continue search as well as isearch
(advice-add #'consult-line :after
(lambda (&rest _)
(when consult--line-history
(add-to-history
'regexp-search-ring
(car consult--line-history)
regexp-search-ring-max)
(add-to-history
'search-ring
(car consult--line-history)
search-ring-max))))
;; bibliography file location
(after! citar
(setq! citar-bibliography '("~/Zotero/lib.bib"))
(setq! citar-notes-paths '("~/Documents/Obsidian/Primary/Sources"))
(setq! citar-file-note-extensions '("md")))
;; svelte support
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.css\\'" . web-mode))
(setq web-mode-engines-alist
'(("svelte" . "\\.svelte\\'")))
(add-to-list 'auto-mode-alist '("\\.vs\\'" . glsl-mode))
(add-to-list 'auto-mode-alist '("\\.fs\\'" . glsl-mode))
;; web-mode settings
(add-hook! web-mode (web-mode-toggle-current-element-highlight))
(after! web-mode
(setq web-mode-markup-indent-offset 2)
(setq web-mode-css-indent-offset 2)
(setq web-mode-code-indent-offset 2))
(after! markdown-mode
(setq markdown-list-indent-width 2)
(setq markdown-enable-wiki-links t))
;; fix centaur tabs to show at the right times
(after! centaur-tabs
(setq centaur-tabs-set-bar 'right)
(setq centaur-tabs-cycle-scope 'tabs))
;; set project paths and ignore buffers
(after! projectile
(setq projectile-project-search-path '(("~/Projects" . 4) ("~/source" . 2) ("~/Music" . 3)))
(setq projectile-globally-ignored-buffers
'("*scratch*"
"*lsp-log*"))
(add-to-list 'projectile-globally-ignored-directories "~/Music/_samples"))
;; projectile ignoring buffers by their major mode
(setq projectile-globally-ignored-modes
'("erc-mode"
"help-mode"
"completion-list-mode"
"Buffer-menu-mode"
"gnus-.*-mode"
"occur-mode"))
;; mouse support for vertico buffers
(after! vertico
(vertico-mouse-mode))
;; sly
(after! sly
(setq sly-lisp-implementations
'((sbcl ("sbcl" "--dynamic-space-size" "4Gb"))
(sbcl-renderdoc ("renderdoccmd" "capture" "-w" "sbcl"))))
(setq sly-default-lisp 'sbcl)
(setq sly-complete-symbol-function 'sly-flex-completions))
;; cl-collider cl-patterns emacs helpers TODO: test this
(after! lisp-mode
(defun cl-patterns-helpers-load ()
(interactive)
(sly-eval-async '(cl:namestring (asdf:system-source-directory (asdf:find-system 'cl-patterns)))
(lambda (path)
(load (concat path "res/emacs/cl-patterns-helpers") nil nil nil t)
(load (concat path "res/emacs/cl-patterns-skeletons") nil nil nil t)))
;; (define-key sly-mode-map (kbd "C-c p") 'cl-patterns-play-or-end-context-or-select-pdef)
;; (define-key sly-mode-map (kbd "C-c P") 'cl-patterns-play-or-stop-context-or-select-pdef)
;; (define-key sly-mode-map (kbd "C-c s") 'cl-patterns-stop-all)
(define-key sly-doc-map (kbd "s") 'cl-patterns-supercollider-documentation)
(add-hook! 'sly-connected-hook 'cl-patterns-helpers-load)))
(set-popup-rule! "*sly-description*" :side 'right :size '0.52)
(after! lisp-markup
(add-hook! 'lisp-mode 'lisp-markup-minor-mode))
(add-to-list 'auto-mode-alist '("\\.lsx\\'" . lisp-mode))
(after! nix-mode
(set-formatter! 'alejandra '("alejandra" "--quiet") :modes '(nix-mode)))
;; add platformio to ino files
(add-to-list 'auto-mode-alist '("\\.ino\\'" . arduino-mode))
(add-to-list 'auto-mode-alist '("\\.ino\\'" . platformio-mode))
(after! gcode-mode
(add-hook! 'gcode-mode-hook 'eldoc-mode))
(use-package!
tramp
:defer t
:config
;; To “turn off” the backup feature for remote files and stop TRAMP from saving to the backup directory.
;; See https://www.gnu.org/software/tramp/#Auto_002dsave-File-Lock-and-Backup
(add-to-list 'backup-directory-alist
(cons tramp-file-name-regexp nil))
(customize-set-variable 'tramp-backup-directory-alist backup-directory-alist)
(setq backup-enable-predicate
(lambda (name) nil)))
;; override aggressive key shortcuts for alt-l/r
(use-package! drag-stuff
:defer t)
(use-package! eglot-booster
:after eglot
:config (eglot-booster-mode))
(setq-default eglot-workspace-configuration
'(:nixd
(:formatting (:command ["alejandra"]))))
;; load additional config files
(load! "obsidian-config.el")
(load! "mu4e-config.el")
;; import all my customized keybindings based on doom evil mode, but with meow instead.
(load! "bindings.el")
(load! "meow.el")
(delete-selection-mode t) ; delete stuff!
(setq delete-active-region t) ; delete selected stuff!
(+global-word-wrap-mode +1) ; default to soft word wrap
(use-package! colorful-mode
:custom
(colorful-use-prefix t)
(colorful-only-strings 'only-prog)
(css-fontify-colors nil)
:config
(global-colorful-mode t)
(add-to-list 'global-colorful-modes 'helpful-mode))