dot-doom/config.el

232 lines
8 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 14))
(setq fancy-splash-image (concat doom-private-dir "splash.png"))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-monokai-pro)
;; 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 t)
(setq scroll-preserve-screen-position t)
;; quick function for removing all blank lines in a buffer
(defun mnl/remove-all-blank-lines ()
(flush-lines "^$"))
;; Modeline
;; - add current workspace name
;; - add major mode icon
(after! doom-modeline
(setq doom-modeline-persp-name t
doom-modeline-major-mode-icon t))
;; fixing compat issue for corfu in emacs28
(defalias 'compat-string-width 'string-width)
;; some global settings
(setq tab-always-indent t) ; don't autocomplete with tab
(+global-word-wrap-mode +1) ; default to soft word wrap
(delete-selection-mode 1) ; delete stuff!
(setq delete-active-region t) ; delete selected stuff!
;; remove org agenda from the splash screen
(assoc-delete-all "Open org-agenda" +doom-dashboard-menu-sections)
(setq +tree-sitter-hl-enabled-modes t) ; REVIEW highlight using tree-sitter ... maybe? still testing
;; nicer resizing
(cond
((string-equal system-type "darwin")
(setq frame-resize-pixelwise t
window-resize-pixelwise t)))
;; tabs! i like them
(setq-default indent-tabs-mode t)
(setq-default tab-width 2)
;; import all my customized keybindings based on doom evil mode, but without evil.
(load! "bindings.el")
;; Lispy mode
(setq aw-dispatch-always t)
(map! :map lispy-mode-map
"M-<left>" nil
"M-<right>" nil)
(map! :map lispy-mode-map-lispy
"M-<left>" nil
"M-<right>" nil)
;; treemacs -- NOTE i'm not using this right now, switched back to neotree for now
;; (setq treemacs-follow-mode t)
;; (setq treemacs-project-follow-mode t)
;; smart tabs set modes
(after! smart-tabs-mode
(smart-tabs-insinuate 'c 'javascript 'python))
;; lsp mode config to work with corfu/cape
(after! lsp-mode
(setq lsp-completion-provider :none)
(setq lsp-signature-render-documentation nil)
(setq lsp-completion-show-kind t)
(defun my/lsp-mode-setup-completion ()
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
'(orderless)))
(add-hook! lsp-completion-mode 'my/lsp-mode-setup-completion))
(after! lisp-mode
(setq lsp-completion-provider :none))
;; bibliography file location
(setq! citar-bibliography '("/Users/emenel/Zotero/lib.bib"))
;; svelte support
(add-to-list 'auto-mode-alist '("\\.svelte\\'" . web-mode))
(setq web-mode-engines-alist
'(("svelte" . "\\.svelte\\'")))
;; custom keybind for adding html closing tag because i have muscle memory from sublime
(after! web-mode
(map! :map web-mode-map
"M-s-." 'web-mode-element-close))
(add-hook! web-mode (web-mode-use-tabs) (setq indent-tabs-mode t))
;; fix centaur tabs to show at the right times and add my muscle memory keybind
(after! centaur-tabs
(setq centaur-tabs-set-bar 'right)
(setq centaur-tabs-cycle-scope 'tabs)
(map! :map centaur-tabs-mode-map
"s-M-<right>" 'centaur-tabs-forward
"s-M-<left>" 'centaur-tabs-backward))
;; configure moom for easy frame management
(use-package! moom
:load-path "/Users/emenel/Source/_src/moom"
:after-call doom-after-init-hook
:config
(setq moom-use-font-module nil)
(moom-recommended-keybindings '(all wof))
(setq moom-user-margin '(50 50 50 50))
(setq moom-command-with-centering '(single double delete split))
(when (display-graphic-p) (defun my-moom-default-frame-size () (set-frame-width (selected-frame) 150) (set-frame-height (selected-frame) 48) (moom-move-frame-to-center)) (add-hook! 'moom-mode-hook #'my-moom-default-frame-size) (moom-mode 1)))
;; use kitty for terminal-here
(setq terminal-here-mac-terminal-command '("kitty"))
;; set project paths and ignore buffers
(setq projectile-project-search-path '(("~/Source" . 2)))
(setq projectile-globally-ignored-buffers
'("*scratch*"
"*lsp-log*"))
;; 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"))
;; configure obsidian integration for note taking fun times
(use-package! obsidian
:config
(obsidian-specify-path "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary")
(setq obsidian-inbox-directory "_Inbox")
(global-obsidian-mode t)
(map! :map obsidian-mode-map
;; Replace C-c C-o with Obsidian.el's implementation.
"C-c C-o" #'obsidian-follow-link-at-point
;; Jump to backlinks
"C-c C-b" #'obsidian-backlink-jump
;; If you prefer you can use `obsidian-insert-link'
"C-c C-l" #'obsidian-insert-wikilink))
;; custom quick capture template for obsidian daily note
(defun mnl/obsidian-capture ()
"Create new obsidian note. In the `obsidian-inbox-directory' if set otherwise in `obsidian-directory' root."
(interactive)
(let* ((title (read-from-minibuffer "Title: " (format-time-string "%Y-%m-%d")))
(filename (s-concat obsidian-directory "/" obsidian-inbox-directory "/" title ".md"))
(clean-filename (s-replace "//" "/" filename)))
(find-file (expand-file-name clean-filename) t)))
(map! :leader
:desc "Obsidian Quick Capture"
"X" #'mnl/obsidian-capture)
(map! :leader
:prefix "n"
:desc "Obsidian Jump"
"f" #'obsidian-jump
:desc "Obsidian Search"
"s" #'obsidian-search
"*" #'obsidian-search
:desc "Obsidian Tag Search"
"m" #'obsidian-tag-find
:desc "Obsidian Capture"
"n" #'mnl/obsidian-capture
"a" nil
"d" nil)
(map! :after markdown-mode
:leader
:prefix "n"
:desc "Obsidian Insert Wikilink"
"l" #'obsidian-insert-wikilink
:desc "Obsidian Backlink Jump"
"j" #'obsidian-backlink-jump)
(setq org-directory "~/Library/Mobile Documents/iCloud~md~obsidian/Documents/Primary/org/")
;; mouse support for vertico buffers
(after! vertico
(vertico-mouse-mode))
;; better completions for sly
(after! sly
(setq sly-complete-symbol-function 'sly-flex-completions))
;; make esc close completion from corfu
(map! :map corfu-map [escape] 'corfu-quit)
;; 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)))
;; tidal cycles!
(setq tidal-boot-script-path "~/.cabal/share/aarch64-osx-ghc-9.4.2/tidal-1.9.3/BootTidal.hs")
;; TODO update this for sly to use ciel by default
;; (setq slime-lisp-implementations
;; `((sbcl ("sbcl")) ;; default. Adapt if needed.
;; (ciel-sbcl ("sbcl" "--core" "/path/to/ciel/ciel-core" "--eval" "(in-package :ciel-user)"))))
;; (setq slime-default-lisp 'ciel-sbcl)