Add some fairly basic initial configuration

This commit is contained in:
Jesse Braham 2025-02-09 13:47:12 +01:00
parent 0359ef22e9
commit 214c7ee964
5 changed files with 79 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
auto-save-list/
elpa/
transient/
*~

12
early-init.el Normal file
View File

@ -0,0 +1,12 @@
;;; early-init.el -*- lexical-binding: t; -*-
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
;; package and UI initialization happens, and before site files are loaded.
;; Minimize garbage collection during startup.
(setq gc-cons-threshold most-positive-fixnum)
;; Lower threshold back to 8 MiB (default is 800kB)
(add-hook 'emacs-startup-hook
(lambda ()
(setq gc-cons-threshold (expt 2 23))))

42
init.el Normal file
View File

@ -0,0 +1,42 @@
;;; init.el --- A (reasonably) minimal initialization file for Emacs.
;; Manage package configuration via `use-package`.
;; https://github.com/jwiegley/use-package
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("stable" . "https://stable.melpa.org/packages/")))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;; Define a couple simple helper functions for loading user-defined
;; configuration files.
(defconst user-init-dir "~/.emacs.d/")
(defun load-user-file (file)
(interactive "f")
"Load a file in the current user's configuration directory"
(load-file (expand-file-name file user-init-dir)))
(defun load-user-dir (dir)
(interactive "f")
"Recursively load all files in a given directory, relative to the user's
configuration directory"
(setq config-dir (file-name-concat user-init-dir dir))
(dolist (file (directory-files-recursively config-dir ""))
(load-user-file file)))
;; Load all user-defined configuration files:
(load-user-file "key-bindings.el")
(load-user-file "typography.el")

14
key-bindings.el Normal file
View File

@ -0,0 +1,14 @@
;; Globally un-set "C-z", which suspends Emacs by default (and is super
;; annoying!).
(global-unset-key (kbd "C-z"))
;; Make it easier to move between windows. Windows can be navigated using
;; <shift> in combination with the arrow keys.
(setq windmove-wrap-around t)
(windmove-default-keybindings)
;; Enable code folding in programming modes, and set some more reasonable
;; shortcuts.
(add-hook 'prog-mode-hook #'hs-minor-mode)
(global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h")) ; Hide a block
(global-set-key (kbd "C-c C-s") (kbd "C-c @ C-s")) ; Show a block

6
typography.el Normal file
View File

@ -0,0 +1,6 @@
;; Make sure that UTF-8 is *ALWAYS* the default encoding.
(set-charset-priority 'unicode)
(prefer-coding-system 'utf-8-unix)
;; Prettify symbols (eg. lambda -> λ).
(global-prettify-symbols-mode)