dotfiles/emacs/.emacs.d/init.el

141 lines
4.0 KiB
EmacsLisp

;; -*- lexical-binding: t; -*-
;; Some startup time optimizations stolen from Doom emacs
(defvar file-name-handler-alist-backup file-name-handler-alist)
(setq file-name-handler-alist nil)
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold 16777216 ; 16mb
gc-cons-percentage 0.1
file-name-handler-alist file-name-handler-alist-backup)))
;; Start the server after init
(autoload 'server-running-p "server")
(defun server-start-if-not-running ()
(unless (server-running-p)
(server-start)))
(add-hook 'emacs-startup-hook #'server-start-if-not-running)
;; Bootstrap the straight.el package manager
(setq straight-check-for-modifications '(check-on-save find-when-checking)
straight-cache-autoloads t)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el"
user-emacs-directory))
(bootstrap-version 5))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
;; Load up use-package for subsequent configuration
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(use-package benchmark-init
:ensure t
:config
;; To disable collection of benchmark data after init is done.
(add-hook 'after-init-hook 'benchmark-init/deactivate))
;; "Garbage Collection Magic Hack"
(use-package gcmh
:demand t
:config
(gcmh-mode 1))
;; Fix $PATH
(use-package exec-path-from-shell
:hook (after-init . exec-path-from-shell-initialize)
:custom
(exec-path-from-shell-variables
'("PATH" "MANPATH" "INFOPATH" "LEDGER_FILE"
"WORKON_HOME" "PIPENV_VERBOSITY" "PIPENV_DONT_LOAD_ENV"
"PIPENV_MAX_DEPTH" "PIPENV_VENV_IN_FILE" "PYENV_ROOT"
"KOPS_STATE_STORE" "PLAID_CLIENT_ID" "PLAID_SECRET"
"PLAID_ENVIRONMENT" "NAVI_PATH" "NAVI_REPOS"))
(exec-path-from-shell-check-startup-files nil)
(exec-path-from-shell-arguments '("-l")))
;; Don't use this file as the custom-file
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
;; Load config modules
(add-to-list 'load-path (expand-file-name "config" user-emacs-directory))
(require 'init-defaults)
(require 'init-undo)
(require 'init-evil)
(require 'init-keybindings)
(require 'init-auth)
(require 'init-lib)
(require 'init-elisp)
(require 'init-org)
(require 'init-profiler)
(require 'init-built-ins)
(require 'init-utils)
(require 'init-dashboard)
(require 'init-dotfiles)
(require 'init-buffers)
(require 'init-files)
(require 'init-windows)
(require 'init-dired)
(require 'init-completion)
(require 'init-editing)
(require 'init-ui)
(require 'init-projects)
(require 'init-git)
(require 'init-ide)
(require 'init-vterm)
(require 'init-eshell)
(require 'init-help)
(require 'init-treesit)
(require 'init-python)
(require 'init-clojure)
(require 'init-lisp)
(require 'init-java)
(require 'init-scala)
(require 'init-js)
(require 'init-ruby)
(require 'init-rust)
(require 'init-web)
(require 'init-markdown)
(require 'init-astro)
(require 'init-xml)
(require 'init-yaml)
(require 'init-groovy)
(require 'init-terraform)
(require 'init-docker)
(require 'init-nix)
(require 'init-lua)
(require 'init-run-command)
(require 'init-aws)
(require 'init-prodigy)
(require 'init-direnv)
(require 'init-email)
(require 'init-kubernetes)
(require 'init-epub)
(require 'init-pdf)
(require 'init-homebrew)
(require 'init-devdocs)
(require 'init-elfeed)
(require 'init-1pass)
(require 'init-wallabag)
(require 'init-plantuml)
(require 'init-mermaid)
(require 'init-games)
(require 'handwriting)
(require 'init-navi)
(when (string-equal system-type "darwin")
(require 'init-mac))
(load (expand-file-name (concat user-emacs-directory "local.el")) 'noerror 'nomessage)
(when (file-exists-p custom-file)
(load custom-file 'noerror 'nomessage))