;;; init.el -- My emacs config -*- lexical-binding: t -*- ;;; Commentary: ;; Moving my Emacs config from separate directory ;; To install packages on non-NixOS systems run `install.el' ;;; Code: ;; Stop popups for warning messages, keep in log buffer (setopt warning-minimum-level :error) ;; Disable `suspend-frame' command (put 'suspend-frame 'disabled "Doesn't work nicely with tiling window managers (e.g. Sway)") ;; Configure packages archives with priority (load-file (locate-user-emacs-file "package-config.el")) (setq custom-file (locate-user-emacs-file "custom.el")) (when (and custom-file (file-exists-p custom-file)) (load custom-file nil 'nomessage)) (setq user-full-name "Evie Litherland-Smith" user-mail-address "evie@xenia.me.uk" use-short-answers t load-prefer-newer t even-window-sizes t tab-always-indent 'complete completion-cycle-threshold nil completions-detailed t kill-do-not-save-duplicates t) (setopt scroll-conservatively 101) (use-package pixel-scroll :init (pixel-scroll-precision-mode +1)) (use-package mwheel :custom (mouse-wheel-scroll-amount '(1 ((shift) . 1))) (mouse-wheel-progressive-speed nil) (mouse-wheel-follow-mouse t)) ;; Bind normal forward/back buttons on mouse to next/previous buffer respectively (keymap-global-set "" #'previous-buffer) (keymap-global-set "" #'next-buffer) ;; Quick bind for calling `git-sync-all' (defun my/git-sync-all () "Run shell command `git-sync-all' asynchronously." (interactive) (async-shell-command "git-sync-all" "*git-sync-all*" "*git-sync-errors*")) (keymap-global-set "C-c g s" #'my/git-sync-all) (set-default-coding-systems 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-coding-system 'utf-8) (global-auto-revert-mode +1) (delete-selection-mode +1) (setopt ;; No tabs indent-tabs-mode nil ;; Only display async output buffer when there's something to show async-shell-command-display-buffer nil ;; Scroll compilation buffer output compilation-scroll-output t) ;; Make shebang (#!) file executable when saved (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) (setq backup-directory-alist '(("." . "~/.local/state/emacs/backups"))) (savehist-mode +1) (use-package dired :custom (dired-auto-revert-buffer t) (dired-dwim-target t)) (use-package recentf :config (run-at-time nil (* 5 60) 'recentf-save-list) (recentf-mode +1) :custom (recentf-max-saved-items 2048)) (use-package auth-source :custom (auth-sources '("secrets:Login"))) (use-package auth-source-pass :requires auth-source :config (auth-source-pass-enable)) ;; Make `describe-*' screens more helpful (use-package helpful :defines helpful-mode-map :bind ((" " . helpful-command) (" " . helpful-callable) (" " . helpful-key) (" " . helpful-symbol) (" " . helpful-variable) ("C-h F" . helpful-function) :map helpful-mode-map (" " . helpful-update))) ;; Bind extra `describe-*' commands (keymap-global-set "C-h K" #'describe-keymap) ;; turn on spell checking, if available. (use-package ispell :custom (ispell-dictionary "en_GB")) (use-package flyspell :hook ((text-mode . flyspell-mode) (prog-mode . flyspell-prog-mode)) :init (require 'ispell) (require 'org) ; Fails without org-mode-map for some reason... :custom (flyspell-mode-line-string nil) (flyspell-use-meta-tab nil) :config (require 'flyspell-correct) (require 'consult-flyspell)) (use-package flyspell-correct :after flyspell :bind ( :map flyspell-mode-map ("C-;" . flyspell-correct-wrapper))) (use-package consult-flyspell :after (consult flyspell) :bind ( :map flyspell-mode-map ("C-c s ;" . consult-flyspell)) :custom (consult-flyspell-always-check-buffer t)) (use-package ibuffer :defines ibuffer-filter-groups :bind (("C-c b" . ibuffer))) (use-package ibuffer-project :after (ibuffer project) :functions ibuffer-project-generate-filter-groups :hook ((ibuffer . (lambda () (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups)))))) (use-package ace-window :bind ((" " . ace-window)) :custom (aw-scope 'frame) (aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))) (use-package link-hint :bind (("C-c l o" . link-hint-open-link) ("C-c l c" . link-hint-copy-link) ("C-c l C-o" . link-hint-open-all-link) ("C-c l C-c" . link-hint-copy-all-link))) (use-package avy :bind ((" " . avy-goto-char))) (use-package which-func :init (which-function-mode)) (use-package shell :bind (("C-c t s" . shell))) (use-package eshell :bind (("C-c t e" . eshell))) (use-package xref :custom (xref-show-definitions-function 'xref-show-definitions-completing-read)) (use-package calendar :bind (("C-c >" . calendar)) :custom (calendar-date-style 'iso) (calendar-mark-holidays-flag t) (calendar-mark-diary-entries-flag nil) (calendar-view-holidays-initially-flag nil) (calendar-view-diary-initially-flag nil)) (use-package appt :custom (appt-display-diary nil) (appt-display-format 'echo) (appt-display-interval 5) (appt-message-warning-time 15) :init (appt-activate +1)) (setq inhibit-splash-screen t use-dialog-box nil minibuffer-follows-selected-frame nil truncate-lines nil truncate-partial-width-windows nil) (global-prettify-symbols-mode +1) (global-display-line-numbers-mode -1) (tool-bar-mode -1) (tab-bar-mode -1) (scroll-bar-mode -1) (add-hook 'prog-mode-hook #'(lambda () (display-line-numbers-mode +1))) (use-package which-key :functions which-key-mode :config (which-key-mode +1)) (use-package elec-pair :config (electric-pair-mode +1)) (use-package paren :config (show-paren-mode +1)) ;; add visual pulse when changing focus, like beacon but built-in ;; from from https://karthinks.com/software/batteries-included-with-emacs/ (defun pulse-line (&rest _) "Pulse the current line." (pulse-momentary-highlight-one-line (point))) (dolist (command '(scroll-up-command scroll-down-command recenter-top-bottom other-window)) (advice-add command :after #'pulse-line)) (use-package base16-theme :if (display-graphic-p) :defines base16-catppuccin-latte-theme-colors :custom (base16-theme-distinct-fringe-background nil) (base16-theme-highlight-mode-line 'contrast) :config (require 'font-lock) (require 'outline) (load-theme 'base16-catppuccin-latte t) (dolist (face '(font-lock-doc-face font-lock-comment-face font-lock-comment-delimiter-face)) (set-face-attribute face nil :foreground (plist-get base16-catppuccin-latte-theme-colors :base04))) (dolist (pairing '((outline-1 . :base08) (outline-2 . :base09) (outline-3 . :base0A) (outline-4 . :base0B) (outline-5 . :base0C) (outline-6 . :base0D) (outline-7 . :base0E) (outline-8 . :base0F))) (set-face-attribute (car pairing) nil :foreground (plist-get base16-catppuccin-latte-theme-colors (cdr pairing)))) ) (use-package nerd-icons :functions (nerd-icons-set-font nerd-icons-octicon) :if (display-graphic-p) :config (nerd-icons-set-font "Symbols Nerd Font Mono-12")) (use-package nerd-icons-dired :diminish :requires nerd-icons :hook (dired-mode)) (use-package nerd-icons-ibuffer :diminish :requires nerd-icons :hook (ibuffer-mode)) (use-package nerd-icons-completion :diminish :functions nerd-icons-completion-mode :requires nerd-icons :hook (after-init . (lambda () (nerd-icons-completion-mode +1)))) (use-package nerd-icons-corfu :diminish :requires (corfu nerd-icons) :config (add-to-list 'corfu-margin-formatters #'nerd-icons-corfu-formatter)) (use-package treemacs-nerd-icons :diminish :requires (treemacs nerd-icons) :config (treemacs-load-theme "nerd-icons")) (use-package ligature :functions (ligature-set-ligatures global-ligature-mode) :config (ligature-set-ligatures '(text-mode prog-mode org-mode) '("-<<" "-<" "-<-" "<--" "<---" "<<-" "<-" "->" "->>" "-->" "--->" "->-" ">-" ">>-" "=<<" "=<" "=<=" "<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" "=>=" ">=" ">>=" "<->" "<-->" "<--->" "<---->" "<=>" "<==>" "<===>" "<====>" "::" ":::" "__" "<~~" "" "/>" "~~>" "==" "!=" "/=" "~=" "<>" "===" "!==" "!===" "=/=" "=!=" "<:" ":=" "*=" "*+" "<*" "<*>" "*>" "<|" "<|>" "|>" "<." "<.>" ".>" "+*" "=*" "=:" ":>" "(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "++" "+++" "\\/" "/\\" "|-" "-|" "