;;; init.el --- Initalization -*- lexical-binding: t; -*- ;;; ;;; Commentary: ;;; Various resources were used to hack together this config: ;;; - https://sanemacs.com/ ;;; - https://rossabaker.com/configs/emacs/ ;;; ;;; Code: ;;;;;;;;;;;;;;;;;;;;;;; ;;; Startup ;;; ;;;;;;;;;;;;;;;;;;;;;;; ;;; Startup - Use package ;;; ;; some packages complain if I don't have this (use-package bind-key :demand t :bind (:prefix-map rab/files-map :prefix "C-c f") :bind (:prefix-map rab/toggles-map :prefix "C-c t")) ;;; Startup - Benchmarking ;;; (use-package benchmark-init :ensure t :demand t :hook (after-init . benchmark-init/deactivate) :config (benchmark-init/activate)) ;;; Startup - Garbage collection ;;; (use-package gcmh :ensure t :diminish :init (setq gc-cons-threshold (* 80 1024 1024)) :hook (emacs-startup . gcmh-mode)) ;;; Startup - Better cache location ;;; (use-package no-littering :ensure t :init (setq no-littering-etc-directory "~/.cache/emacs/etc/" no-littering-var-directory "~/.cache/emacs/var/") (when (fboundp 'startup-redirect-eln-cache) (startup-redirect-eln-cache (convert-standard-filename (expand-file-name "eln-cache/" no-littering-var-directory)))) :config (no-littering-theme-backups)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Customization ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Customization - General settings ;;; (use-package emacs :init (setq inhibit-startup-screen t initial-scratch-message nil initial-major-mode 'text-mode ring-bell-function 'ignore use-file-dialog nil) (tool-bar-mode -1) (scroll-bar-mode -1) (setq-default cursor-type 'bar frame-title-format '("%b") ;; Use spaces, but configure tab-width for modes that use tabs indent-tabs-mode nil tab-width 2) (fset 'yes-or-no-p 'y-or-n-p) (show-paren-mode 1) ; Show closing parens (global-auto-revert-mode t) ; Auto-update buffer on file change (setopt create-lockfiles nil) (electric-pair-mode 1) ; Autopairs (global-hl-line-mode) (defun mb/enable-fill-column () "Enable vertical ruler" (interactive) (setq fill-column 80) (display-fill-column-indicator-mode)) (defun display-startup-echo-area-message () (message "")) :hook (prog-mode . mb/enable-fill-column) :bind (("C-z" . undo) ("C-S-z" . undo-redo) ("C-x h" . previous-buffer) ("C-x l" . next-buffer))) ;;; Customization - Scrolling ;;; ;; TODO: Smooth scroll ;;; Customization - Theme ;;; (use-package doom-themes :demand :config ;; Global settings (defaults) (setq doom-themes-enable-bold t ; if nil, bold is universally disabled doom-themes-enable-italic t) ; if nil, italics is universally disabled (load-theme 'doom-laserwave t)) ;;; Customization - Modeline ;;; (use-package doom-modeline :ensure t :config (doom-modeline-mode 1)) (use-package nerd-icons :custom (nerd-icons-font-family "FiraCode Nerd Font Mono")) (use-package nyan-mode :config (nyan-mode)) ;;; Customization - Evil ;;; ;; Set up vi keybinds (use-package evil :demand :init (defun mb/enable-line-numbers () "Enable relative line numbers" (interactive) (display-line-numbers-mode) (setq display-line-numbers 'relative)) :hook ((prog-mode . evil-local-mode) (text-mode . evil-local-mode) (evil-mode . mb/enable-line-numbers) (evil-local-mode . mb/enable-line-numbers))) ;;; Customization - Direnv support ;;; (use-package envrc :ensure t :hook (on-first-file . envrc-global-mode)) ;;; Customziation - Completion framework ;;; (use-package helm :config (setq helm-completion-style 'emacs)) (use-package helm-mode :config (helm-mode 1)) (use-package fussy :config (push 'fussy completion-styles) (setq ;; For example, project-find-file uses 'project-files which uses ;; substring completion by default. Set to nil to make sure it's using ;; flx. completion-category-defaults nil completion-category-overrides nil)) ;;; Customization - Project management ;;; (use-package projectile :bind-keymap ("C-c p" . projectile-command-map) :config (projectile-mode +1)) ;;; Customization - Completions ;;; (use-package company :hook (prog-mode . company-mode)) ;;; Customization - Syntax checking ;;; (use-package flycheck :hook (prog-mode . flycheck-mode)) ;;; Customization - Which key ;;; (use-package which-key :init (setq which-key-idle-delay 0.1) :config (which-key-mode +1)) ;;; Customization - LSP support ;;; (use-package eglot ; nix-mode doesn't have a hook for some reason :mode ("\\.nix\\'" "\\.nix.in\\'")) ;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Languages ;;; ;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Languages - Nix ;;; (use-package nix-mode :mode ("\\.nix\\'" "\\.nix.in\\'")) ;;; Languages - Coq ;;; (use-package proof-general :mode ("\\.v\\'" . coq-mode)) ;;; Languages - Rust ;;; (use-package rustic :init (setq rustic-lsp-client 'eglot) (defun rustic-mode-auto-save-hook () "Enable auto-saving in rustic-mode buffers." (when buffer-file-name (setq-local compilation-ask-about-save nil))) :hook (rustic-mode . rustic-mode-auto-save-hook)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Useful modes ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Useful modes - magit ;;; (use-package magit) ;;; emacs.el ends here