Emacs 29 better defaults
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; Better defaults for Emacs to help get new users up and running quickly. | |
;;;; This configuration is meant to help solve some common usability problems, | |
;;;; particularly with Emacs's default completion framework, cluttered UI, | |
;;;; and package installation. Inspired by the Better Defaults repo: | |
;;;; https://git.sr.ht/~technomancy/better-defaults. | |
;;;; | |
;;;; Annotations are included for various options, but I recommend using | |
;;;; the built-in Emacs help to learn more about each configuration setting. | |
;;;; For example, `C-h v` or `M-x describe-variable`. | |
;; Performance tweaking | |
(setq gc-cons-threshold 100000000) ; 100 mb | |
(setq read-process-output-max (* 1024 1024)) ; 1mb | |
;; Remove UI clutter | |
(menu-bar-mode -1) | |
(tool-bar-mode -1) | |
(scroll-bar-mode -1) | |
(setq inhibit-startup-screen t) | |
;; Set your font preferences here | |
(set-face-attribute 'default nil :height 120) | |
;; On OSX swap meta and super for better keyboard ergonomics. This is | |
;; great if you use a Windows-style keyboard on Mac OS. | |
(defmacro if-osx (&rest body) | |
`(if (eq system-type 'darwin) | |
(progn ,@body))) | |
(if-osx | |
(setq mac-command-modifier 'meta) | |
(setq mac-option-modifier 'super)) | |
;; Unique buffer names for matching files, very useful when dealing | |
;; with lots of index.ts, for example | |
(require 'uniquify) | |
;; Misc. settings | |
;; Use `C-h v` to read the docs on the individual options | |
(electric-pair-mode t) | |
(show-paren-mode 1) | |
(setq-default indent-tabs-mode nil) | |
(save-place-mode t) | |
(savehist-mode t) | |
(recentf-mode t) | |
(global-auto-revert-mode t) | |
;; Display line numbers when in programming modes | |
(add-hook 'prog-mode-hook 'display-line-numbers-mode) | |
(setq uniquify-buffer-name-style 'forward | |
window-resize-pixelwise t | |
frame-resize-pixelwise t | |
load-prefer-newer t | |
backup-by-copying t | |
custom-file (expand-file-name "custom.el" user-emacs-directory)) | |
;; Completion framework, swap this out to Vertico/Ivy/Helm if you'd like | |
(fido-vertical-mode t) | |
(unless package-archive-contents | |
(package-refresh-contents)) | |
;; Great looking theme | |
(use-package modus-themes | |
:ensure t | |
:init | |
(modus-themes-load-themes) | |
:config | |
(modus-themes-load-vivendi)) | |
;; Code-completion at point | |
(use-package company | |
:ensure t | |
:hook (after-init . global-company-mode) | |
:custom | |
(company-idle-delay 0)) | |
;; Better minibuffer completions and project searching | |
(use-package vertico | |
:ensure t | |
:custom | |
(vertico-cycle t) | |
(read-buffer-completion-ignore-case t) | |
(read-file-name-completion-ignore-case t) | |
(completion-styles '(basic substring partial-completion flex)) | |
:init | |
(vertico-mode)) | |
(use-package savehist | |
:init | |
(savehist-mode)) | |
(use-package marginalia | |
:after vertico | |
:ensure t | |
:init | |
(marginalia-mode)) | |
;; Use emacsclient to open files in an already-running Emacs process | |
(require 'server) | |
(unless (server-running-p) (server-start)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to install Emacs (with native compilation)
Install via https://github.com/d12frosted/homebrew-emacs-plus:
Then, create
~/.emacs.d/
and drop thisinit.el
file into that directory: