Initial dotfiles commit
Laptop config: zsh, emacs (with WSL detection for work), ghostty, tmux, ranger, newsboat, neomutt + mbsync + msmtp (Outlook OAuth2), neomutt signature. Work config: emacs with C#/TS/JS/CSS/HTML dev settings for WSL. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
168
laptop/.config/emacs/init.el
Normal file
168
laptop/.config/emacs/init.el
Normal file
@@ -0,0 +1,168 @@
|
||||
;; init.el
|
||||
|
||||
(defun rh/load-user-file (file)
|
||||
"Load FILE from `user-emacs-directory' when it exists."
|
||||
(let ((path (expand-file-name file user-emacs-directory)))
|
||||
(when (file-exists-p path)
|
||||
(load path nil 'nomessage))))
|
||||
|
||||
;;; Startup/UI ---------------------------------------------------------------
|
||||
|
||||
(setq inhibit-startup-message t
|
||||
visible-bell t)
|
||||
|
||||
(scroll-bar-mode -1)
|
||||
(tool-bar-mode -1)
|
||||
(tooltip-mode -1)
|
||||
(menu-bar-mode -1)
|
||||
|
||||
;;; Editing Defaults ---------------------------------------------------------
|
||||
|
||||
(global-display-line-numbers-mode 1)
|
||||
(setq display-line-numbers-type 'relative)
|
||||
|
||||
(setq make-backup-files nil
|
||||
auto-save-default nil
|
||||
create-lockfiles nil)
|
||||
|
||||
(setq vc-follow-symlinks t
|
||||
find-file-visit-truename t)
|
||||
|
||||
;;; Package Manager ----------------------------------------------------------
|
||||
|
||||
(require 'package)
|
||||
|
||||
(setq package-archives '(("melpa" . "https://melpa.org/packages/")
|
||||
("elpa" . "https://elpa.gnu.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)
|
||||
|
||||
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
|
||||
|
||||
;;; Style/Theme --------------------------------------------------------------
|
||||
|
||||
(use-package catppuccin-theme
|
||||
:init
|
||||
(setq catppuccin-flavor 'mocha)
|
||||
:config
|
||||
(load-theme 'catppuccin t))
|
||||
|
||||
;; Icons are only useful in GUI Emacs.
|
||||
(use-package all-the-icons
|
||||
:if (display-graphic-p))
|
||||
|
||||
;; Color nested delimiters in programming buffers.
|
||||
(use-package rainbow-delimiters
|
||||
:hook (prog-mode . rainbow-delimiters-mode))
|
||||
|
||||
(use-package doom-modeline
|
||||
:init
|
||||
(doom-modeline-mode 1)
|
||||
:config
|
||||
(setq doom-modeline-height 15))
|
||||
|
||||
;;; Completion/Search/Navigation ---------------------------------------------
|
||||
|
||||
(use-package vertico
|
||||
:init
|
||||
(vertico-mode))
|
||||
|
||||
(use-package consult
|
||||
:bind (("C-x b" . consult-buffer)
|
||||
("C-s" . consult-line)
|
||||
("M-y" . consult-yank-pop)))
|
||||
|
||||
(use-package orderless
|
||||
:config
|
||||
(setq completion-styles '(orderless basic)
|
||||
completion-category-defaults nil))
|
||||
|
||||
(use-package marginalia
|
||||
:init
|
||||
(marginalia-mode))
|
||||
|
||||
(use-package embark
|
||||
:bind (("C-." . embark-act)
|
||||
("M-." . embark-dwim)))
|
||||
|
||||
(use-package embark-consult
|
||||
:after (embark consult))
|
||||
|
||||
(use-package which-key
|
||||
:init
|
||||
(which-key-mode)
|
||||
:config
|
||||
(setq which-key-idle-delay 1))
|
||||
|
||||
;;; Key Bindings -------------------------------------------------------------
|
||||
|
||||
;; Make ESC quit prompts.
|
||||
(global-set-key (kbd "<escape>") #'keyboard-escape-quit)
|
||||
|
||||
;; windmove: S-Arrow to move between windows (built-in since Emacs 27).
|
||||
(windmove-default-keybindings)
|
||||
|
||||
;;; Projects -----------------------------------------------------------------
|
||||
|
||||
(use-package projectile
|
||||
:init
|
||||
(when (file-directory-p "~/src")
|
||||
(setq projectile-project-search-path '("~/src")))
|
||||
(setq projectile-switch-project-action #'projectile-dired)
|
||||
:config
|
||||
(projectile-mode 1)
|
||||
:bind-keymap
|
||||
("C-c p" . projectile-command-map))
|
||||
|
||||
(use-package consult-projectile
|
||||
:bind (("C-c h" . consult-projectile)))
|
||||
|
||||
;;; Git ----------------------------------------------------------------------
|
||||
|
||||
(use-package magit
|
||||
:commands (magit-status magit-get-current-branch)
|
||||
:bind (("C-x g" . magit-status)
|
||||
("C-x M-g" . magit-dispatch)
|
||||
("C-c M-g" . magit-file-dispatch))
|
||||
:custom
|
||||
(magit-display-buffer-function #'magit-display-buffer-same-window-except-diff-v1)
|
||||
(magit-diff-refine-hunk t)
|
||||
(magit-auto-revert-mode nil)
|
||||
(magit-process-find-password-functions '(magit-process-password-auth-source)))
|
||||
|
||||
;;; Org ----------------------------------------------------------------------
|
||||
|
||||
(defun rh/org-mode-setup ()
|
||||
(org-indent-mode)
|
||||
(visual-line-mode 1))
|
||||
|
||||
(use-package org
|
||||
:hook (org-mode . rh/org-mode-setup)
|
||||
:config
|
||||
(setq org-agenda-files
|
||||
(if (file-directory-p "~/org")
|
||||
(directory-files-recursively "~/org" "\\.org$")
|
||||
nil)))
|
||||
|
||||
(defun rh/wsl-p ()
|
||||
(and (eq system-type 'gnu/linux)
|
||||
(file-exists-p "/proc/version")
|
||||
(with-temp-buffer
|
||||
(insert-file-contents "/proc/version")
|
||||
(string-match-p "microsoft" (buffer-string)))))
|
||||
|
||||
(rh/load-user-file "org-bindings.el")
|
||||
(rh/load-user-file "common-dev-settings.el")
|
||||
(if (rh/wsl-p)
|
||||
(rh/load-user-file "work-dev-settings.el")
|
||||
(rh/load-user-file "dev-settings.el"))
|
||||
(rh/load-user-file "latex-settings.el")
|
||||
(rh/load-user-file "custom.el")
|
||||
Reference in New Issue
Block a user