#+options: ':nil *:t -:t ::t <:t H:3 \n:nil ^:t arch:headline #+options: author:t broken-links:nil c:nil creator:nil #+options: d:(not "LOGBOOK") date:t e:t email:nil f:t inline:t num:t #+options: p:nil pri:nil prop:nil stat:t tags:t tasks:t tex:t #+options: timestamp:t title:t toc:t todo:t |:t #+title: Universe Emacs Config #+author: #+language: en * Initialization ** Leaf.el We must initialize =leaf.el=, which we use as a use-package replacement for defining configs and relations between packages etc. #+begin_src elisp :tangle yes :exports code (eval-and-compile (customize-set-variable 'package-archives '(("org" . "https://orgmode.org/elpa/") ("melpa" . "https://melpa.org/packages/") ("gnu" . "https://elpa.gnu.org/packages/"))) (package-initialize) (unless (package-installed-p 'leaf) (package-refresh-contents) (package-install 'leaf)) (leaf leaf-keywords :ensure t :init (leaf el-get :ensure t) (leaf hydra :ensure t) (leaf blackout :ensure t) :config ;; initialize leaf-keywords.el (leaf-keywords-init))) (leaf leaf-tree :ensure t) (leaf leaf-convert :ensure t) (leaf transient-dwim :ensure t :bind (("M-=" . transient-dwim-dispatch))) #+end_src ** MacOS Specific #+begin_src elisp :tangle yes :exports code (leaf macos :hook (after-init hook) :when (eq system-type 'darwin) :init (setq mac-option-modifier 'meta)) #+end_src ** Performance *** Garbage Collection #+begin_src elisp :tangle yes :exports code (leaf gcmh :ensure t :hook (after-init-hook)) #+end_src *** Profiling #+begin_src elisp :tangle yes :exports code (leaf esup :disabled nil :ensure t) #+end_src ** Emacs Paths *** Custom.el Ensure that the =custom.el= resides in the users' emacs directory. #+begin_src elisp :tangle yes :exports code (leaf custom-el :config ;; Ensure custom writes to specific file (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) (load custom-file 'noerror 'nomessage)) #+end_src *** Backups Set the backups directory to reside in the users' emacs directory. #+begin_src elisp :tangle yes :exports code (leaf backup :config ;; Change the location of file backups/locks into the emacs.d/backups/ (setq backup-directory-alist `(("." . ,(concat user-emacs-directory "backups"))))) #+end_src ** Shell Path Preservation Exec-path-from-shell ensures that path variable is preserved from shell. #+begin_src elisp :tangle yes :exports code (leaf exec-path-from-shell :ensure t :config (exec-path-from-shell-initialize)) #+end_src * Visual Customization Visual Theme of Emacs config: defined in the =themes= directory. #+begin_src elisp :tangle yes :exports code (leaf visual :doc "Visual Changes to Emacs" :tag "builtin" "internal" :custom ((menu-bar-mode . nil) (tool-bar-mode . nil) (scroll-bar-mode . nil)) :custom-face ((default . '((t (:family "JuliaMono" :height 150 :weight normal))))) :config ;; Set location of custom theme dir (setq custom-theme-directory (concat user-emacs-directory "themes")) (load-theme 'UniverseHighContrast)) #+end_src * Version Control #+begin_src elisp :tangle yes :exports code (leaf magit :ensure t :require t) #+end_src * Nix Related ** Direnv In order to support direnv (loading =nix-shell= / =nix develop=) #+begin_src elisp :tangle yes :exports code (leaf direnv :ensure t :config (direnv-mode)) #+end_src ** Nix-mode =.nix= file mode #+begin_src elisp :tangle yes :exports code (leaf nix-mode :ensure t) #+end_src * IDE Like Things ** Which Key Again? #+begin_src elisp :tangle yes :exports code (leaf which-key :ensure t :config (which-key-mode)) #+end_src ** Company Completion! We like autocomplete, it... is nice, okay? #+begin_src elisp :tangle yes :exports code (leaf company :ensure t :bind (("C-" . company-complete)) :hook after-init-hook :config (global-company-mode)) #+end_src ** Language Server Protocol We love language features that make languages nice #+begin_src elisp :tangle yes :exports code (leaf lsp-mode :ensure t :init (setq lsp-keymap-prefix "C-c l") :commands lsp lsp-deferred :hook ;; which key support v v v ((lsp-mode-hook . lsp-enable-which-key-integration) #+end_src *** IDE Languages **** Dart/Flutter #+begin_src elisp :tangle yes :exports code (dart-mode . lsp-deferred) #+end_src **** Python #+begin_src elisp :tangle yes :exports code (python-mode . lsp-deferred) #+end_src **** C/C++ #+begin_src elisp :tangle yes :exports code (c-mode-hook . lsp-deferred) (c++-mode-hook . lsp-deferred) #+end_src **** Haskell #+begin_src elisp :tangle yes :exports code (haskell-mode-hook . lsp-deferred) #+end_src **** Java #+begin_src elisp :tangle yes :exports code (java-mode-hook . lsp-deferred) #+end_src **** Rust #+begin_src elisp :tangle yes :exports code (rust-mode-hook . lsp-deferred)) #+end_src #+begin_src elisp :tangle yes :exports code ) #+end_src *** LSP Plugins: We do want some nice to haves of course - A pretty UI: #+begin_src elisp :tangle yes :exports code (leaf lsp-ui :ensure t :commands lsp-ui-mode) #+end_src - Flycheck compat: #+begin_src elisp :tangle yes :exports code (leaf flycheck :ensure t) #+end_src - Debugger Compatibility #+begin_src elisp :tangle yes :exports code (leaf dap-mode :ensure t) #+end_src *** Projectile (Projects) #+begin_src elisp :tangle yes :exports code (leaf projectile :commands projectile-mode :config (projectile-mode +1)) #+end_src * WEB We all know the web is the future, obviously, of course. #+begin_src elisp :tangle yes :exports code (leaf web-mode :ensure t :mode "\\.p?html?\\'" "\\.djtml\\'" "\\.jsx?\\'" "\\.tsx?\\'") (leaf php-mode :ensure t) #+end_src * D2 #+begin_src elisp :tangle yes :exports code (leaf d2-mode :ensure t) #+end_src * YAML #+begin_src elisp :tangle yes :exports code (leaf yaml-mode :ensure t) #+end_src * Python Things ** Python-mode Using python-mode is to have more up to date features (and highlighting) compared to builtin python-mode. #+begin_src elisp :tangle yes :exports code (leaf python-mode :ensure t :config (setq python-shell-interpreter "ipython" python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True")) #+end_src ** Poetry For when we aren't nix'ing things, and want some nice poetry. #+begin_src elisp :tangle yes :exports code (leaf poetry :ensure t) #+end_src * C Who even needs C++, not me, no way, no how. #+begin_src elisp :tangle yes :exports code (leaf c-config :hook c-mode-hook c++-mode-hook :config (leaf company-ctags :ensure t) (leaf company-c-headers :ensure t) (leaf meson-mode :ensure t)) #+end_src * Haskell #+begin_src elisp :tangle yes :exports code (leaf haskell-mode :ensure t) (leaf lsp-haskell :ensure t) (leaf company-ghci :ensure t) #+end_src * Rust #+begin_src elisp :tangle yes :exports code (leaf rust-mode :ensure t :init (leaf slint-mode :ensure t)) #+end_src * Minecraft?? Minecraft =mcfunction= support, because, it can be annoying to type this stuff otherwise. #+begin_src elisp :tangle yes :exports code (leaf mcf-mode :el-get rasensuihei/mcf) #+end_src * Lisps Gonna need to have pretty brackets #+begin_src elisp :tangle yes :exports code (leaf rainbow-delimiters :ensure t :commands rainbow-delimiters-mode :config (leaf rainbow :hook (emacs-lisp-mode-hook . rainbow-delimiters-mode) (geiser-mode-hook . rainbow-delimiters-mode))) #+end_src ** Racket Makes using racket so much nicer #+begin_src elisp :tangle yes :exports code (leaf geiser-racket :ensure t) #+end_src * Org We ensure that org is available (though it is builtin) #+begin_src elisp :tangle yes :exports code (leaf org :ensure t :require t org-tempo :hook (org-mode-hook . auto-fill-mode) :config (setq document-dir (expand-file-name (if (eq system-type 'darwin) "~/Nextcloud" "~/Documents"))) (setq org-directory (concat document-dir "/org")) (set-fill-column 100) (setq org-src-fontify-natively t org-confirm-babel-evaluate nil org-src-preserve-indentation t)) ;; (tempo-define-template "Fig. Caption" ;; '("" (P "Image: " image t) ;; (P "Caption: " caption t) ;; (P "Figure Name: " name t) ;; "#+CAPTION: " (s caption) > n > ;; "#+NAME: fig:" (s name) > n > ;; "#+ATTR_LaTeX: :placement [H]" > n > ;; "[[" (s image) "]]" > n > p >) ;; "