This repository has been archived on 2026-10-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SimplyEmacs/init.el
T

218 lines
6.6 KiB
EmacsLisp
Executable File

;;; init.el --- SimplyEmacs: bootstrap, UI, built-in settings -*- lexical-binding: t; -*-
;;; Commentary:
;; The "bare Emacs" layer: package bootstrap, general UI, fonts, built-in
;; behaviour, and the module loader. Anything beyond vanilla UI/built-in
;; settings lives in its own lisp/ file and is required near the bottom, so
;; this file stays readable as "what does bare Emacs look and feel like".
;;; Code:
;; Make Emacs find programs installed in ~/.local/bin
(add-to-list 'exec-path (expand-file-name "~/.local/bin"))
(setenv "PATH"
(concat (expand-file-name "~/.local/bin")
path-separator
(getenv "PATH")))
;; GC restore - see early-init.el
(add-hook 'emacs-startup-hook
(lambda () (setq gc-cons-threshold (* 16 1024 1024))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Package Setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'package)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa" . "https://melpa.org/packages/")))
(package-initialize)
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-install 'use-package))
(require 'use-package)
(setq use-package-always-ensure t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Module Loader
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Anything beyond vanilla UI/built-in behaviour lives in its own lisp/ file
;; and is required at the bottom, so this file stays the "bare Emacs" layer.
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; General UI
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(global-so-long-mode 1)
(setq frame-resize-pixelwise t)
(setq inhibit-startup-screen t)
(setq initial-scratch-message nil)
(setq-default header-line-format mode-line-format)
(setq-default mode-line-format nil)
(blink-cursor-mode 0)
(setq ring-bell-function #'ignore)
(global-hl-line-mode 1)
(global-display-line-numbers-mode 1)
(column-number-mode 1)
(size-indication-mode 1)
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(fset 'yes-or-no-p #'y-or-n-p)
(repeat-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Fonts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Main font
(set-face-attribute 'default nil
:family "JetBrainsMono Nerd Font"
:height 120
:weight 'regular)
;; Variable pitch font (used by Org, Markdown, etc. if enabled)
(set-face-attribute 'variable-pitch nil
:family "Noto Sans"
:height 130
:weight 'regular)
;; Fixed pitch should match the default font
(set-face-attribute 'fixed-pitch nil
:family "JetBrainsMono Nerd Font"
:height 120
:weight 'regular)
;; Slightly larger mode line
(set-face-attribute 'mode-line nil
:height 130)
(set-face-attribute 'mode-line-inactive nil
:height 130)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Keep Projects Clean (built-in)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq backup-directory-alist
`(("." . ,(expand-file-name "backups/" user-emacs-directory))))
(setq auto-save-file-name-transforms
`((".*" ,(expand-file-name "auto-save/" user-emacs-directory) t)))
(setq create-lockfiles nil)
(make-directory (expand-file-name "backups/" user-emacs-directory) t)
(make-directory (expand-file-name "auto-save/" user-emacs-directory) t)
(save-place-mode 1)
(savehist-mode 1)
(recentf-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Convenience (built-in)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq scroll-conservatively 101)
(setq scroll-margin 15)
(electric-pair-mode 1)
(show-paren-mode 1)
;; Command Palette
(global-set-key (kbd "C-S-p") #'execute-extended-command)
(defun my/keyboard-quit ()
"Escape behaves like C-g."
(interactive)
(keyboard-quit))
(global-set-key (kbd "<escape>") #'my/keyboard-quit)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Don't ask so many questions (built-in)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Quit immediately
(setq confirm-kill-emacs nil)
;; Don't ask before killing buffers with running processes
(setq confirm-kill-processes nil)
;; Don't ask about active processes when exiting
(setq kill-buffer-query-functions nil)
;; Follow symlinks without asking
(setq vc-follow-symlinks t)
;; Revert changed files automatically
(global-auto-revert-mode 1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Modules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; vim motions used sparingly
(require 'init-evil)
;; file browser
(require 'init-dired)
;; code completion
(require 'init-completion)
;; project management
(require 'init-project)
;; project building
(require 'init-build)
;; development languages and lsp
(require 'init-dev)
;; version control git
(require 'init-git)
;; theme
(require 'init-theme)
;; cheatsheet
(require 'init-cheatsheet)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Custom
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Custom's auto-generated output goes to its own custom.el so a stray
;; `M-x customize' never leaves noise in this hand-written init.
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(when (file-exists-p custom-file)
(load custom-file))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-vc-selected-packages
'((odin-ts-mode :url "https://github.com/Sampie159/odin-ts-mode"))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;;; init.el ends here