;;; init.el --- Minimal Emacs: built-ins + evil -*- lexical-binding: t; -*- ;; Learning: C-h k KEY, f FUNCTION, v VARIABLE, m (modes), b (bindings). ;;; Code: ;;;; 1. Setup: gc, PATH, var/, packages (add-hook 'emacs-startup-hook (lambda () (setq gc-cons-threshold (* 16 1024 1024)))) (dolist (bin (list (expand-file-name "~/.local/bin") (expand-file-name "~/.go/bin"))) (add-to-list 'exec-path bin) (setenv "PATH" (concat bin path-separator (getenv "PATH")))) (add-to-list 'custom-theme-load-path (expand-file-name "themes" user-emacs-directory)) ;; All runtime files live in var/. early-init.el redirects eln-cache and elpa. (defvar my/var (locate-user-emacs-file "var/")) (make-directory (concat my/var "transient/") t) (setq savehist-file (concat my/var "history") save-place-file (concat my/var "places.eld") project-list-file (concat my/var "projects.eld") transient-history-file (concat my/var "transient/history.el") transient-levels-file (concat my/var "transient/levels.el") transient-values-file (concat my/var "transient/values.el")) ;; Customize output goes to its own file. (setq custom-file (expand-file-name "var/custom.el" user-emacs-directory)) (load custom-file 'noerror 'nomessage) ;; Only GNU and NonGNU ELPA (defaults). package-initialize runs automatically. (require 'use-package) (setq use-package-always-ensure t) ;;;; 2. UI, theme, fonts ;; Menu/tool/scroll bars are removed in early-init.el. (add-to-list 'default-frame-alist '(fullscreen . maximized)) (blink-cursor-mode -1) (setq inhibit-startup-screen t ring-bell-function #'ignore use-short-answers t scroll-conservatively 101 scroll-margin 20) (setq-default indent-tabs-mode nil tab-width 4) (global-hl-line-mode 1) (global-display-line-numbers-mode 1) (pixel-scroll-precision-mode 1) (column-number-mode 1) (electric-pair-mode 1) (which-key-mode 1) (load-theme 'minimal t) ;; Mode line at the top of each window. (setq-default header-line-format mode-line-format mode-line-format nil) (set-face-attribute 'default nil :family "JetBrainsMono Nerd Font" :height 120) (setq-default line-spacing '(4 . 4)) ;; Command launcher. (keymap-global-set "C-S-p" #'execute-extended-command) ;; Full buffer list. (keymap-global-set "C-l" #'ibuffer) ;; Escape behaves like C-g. (keymap-global-set "" #'keyboard-quit) (keymap-set minibuffer-local-map "" #'abort-minibuffers) ;;;; 3. Files (setq make-backup-files nil auto-save-default nil auto-save-list-file-prefix nil create-lockfiles nil confirm-kill-processes nil vc-follow-symlinks t) (save-place-mode 1) (savehist-mode 1) (global-auto-revert-mode 1) ;;;; 4. Completion ;; Built-in vertical minibuffer completion with flex matching. ;; RET picks the highlighted candidate, C-j submits the typed text as-is. (fido-vertical-mode 1) (setq icomplete-prospects-height 15 completion-styles '(basic partial-completion flex) completion-ignore-case t read-buffer-completion-ignore-case t read-file-name-completion-ignore-case t completions-format 'one-column isearch-lazy-count t xref-search-program 'ripgrep) ;;;; 5. Dired ;; Evil keys for dired live in modules/evil.el. (setq dired-dwim-target t dired-kill-when-opening-new-dired-buffer t dired-listing-switches "-agho --group-directories-first" dired-recursive-copies 'always delete-by-moving-to-trash t) (with-eval-after-load 'dired (require 'dired-x) (setq dired-omit-files "\\`\\.") (add-hook 'dired-mode-hook #'dired-omit-mode)) ;;;; Core config ends here. ;;;; ----------------------------------------------------------------- ;;;; 6. Modules. evil first: later modules may call evil-define-key. (load (locate-user-emacs-file "modules/evil.el") nil 'nomessage) (load (locate-user-emacs-file "modules/org.el") nil 'nomessage) (load (locate-user-emacs-file "modules/git.el") nil 'nomessage) (load (locate-user-emacs-file "modules/build.el") nil 'nomessage) (load (locate-user-emacs-file "modules/dev.el") nil 'nomessage) ;;; init.el ends here