;;; post-init.el --- User Init -*- lexical-binding: t; -*- (load-theme 'modus-vivendi) (repeat-mode 1) (setq auth-sources '(password-store "~/.authinfo.gpg")) (require 'auth-source-pass) (auth-source-pass-enable) (use-package abbrev :ensure nil :custom (save-abbrevs nil) :config (defun emacs-solo/abbrev--replace-placeholders () "Replace placeholders ###1###, ###2###, ... with minibuffer input. If ###@### is found, remove it and place point there at the end." (let ((cursor-pos nil)) (save-excursion (goto-char (point-min)) (let ((loop 0) (values (make-hash-table :test 'equal))) (while (re-search-forward "###\\([0-9]+\\|@\\)###" nil t) (setq loop (1+ loop)) (let* ((index (match-string 1)) (start (match-beginning 0)) (end (match-end 0))) (cond ((string= index "@") (setq cursor-pos start) (delete-region start end)) (t (let* ((key (format "###%s###" index)) (val (or (gethash key values) (let ((input (read-string (format "Value for %s: " key)))) (puthash key input values) input)))) (goto-char start) (delete-region start end) (insert val) (goto-char (+ start (length val)))))))))) (when cursor-pos (goto-char cursor-pos)))) (define-abbrev-table 'global-abbrev-table '(;; Arrows ("ra" "→") ("la" "←") ("ua" "↑") ("da" "↓") ;; HTML entities ("nb" " ") ("lt" "<") ("gt" ">") ;; Markdown ("cb" "```@\n\n```" (lambda () (search-backward "@") (delete-char 1))) ;; ORG ("ocb" "#+BEGIN_SRC @\n\n#+END_SRC" (lambda () (search-backward "@") (delete-char 1))) ("oheader" "#+TITLE: ###1###\n#+AUTHOR: ###2###\n#+EMAIL: ###3###\n#+OPTIONS: toc:nil\n" emacs-solo/abbrev--replace-placeholders) ;; JS/TS snippets ("imp" "import { ###1### } from '###2###';" emacs-solo/abbrev--replace-placeholders) ("fn" "function ###1### () {\n ###@### ;\n};" emacs-solo/abbrev--replace-placeholders) ("clog" "console.log(\">>> LOG:\", { ###@### })" emacs-solo/abbrev--replace-placeholders) ("cwarn" "console.warn(\">>> WARN:\", { ###@### })" emacs-solo/abbrev--replace-placeholders) ("cerr" "console.error(\">>> ERR:\", { ###@### })" emacs-solo/abbrev--replace-placeholders) ("afn" "async function() {\n \n}" (lambda () (search-backward "}") (forward-line -1) (end-of-line))) ("ife" "(function() {\n \n})();" (lambda () (search-backward ")();") (forward-line -1) (end-of-line))) ("esdeps" "// eslint-disable-next-line react-hooks/exhaustive-deps" (lambda () (search-backward ")();") (forward-line -1) (end-of-line))) ("eshooks" "// eslint-disable-next-line react-hooks/rules-of-hooks" (lambda () (search-backward ")();") (forward-line -1) (end-of-line))) ;; React/JSX ("rfc" "const ###1### = () => {\n return (\n
###2###
\n );\n};" emacs-solo/abbrev--replace-placeholders)))) (setopt tab-always-indent 'complete read-buffer-completion-ignore-case t read-file-name-completion-ignore-case t ;; This *may* need to be set to 'always just so that you don't ;; miss other possible good completions that match the input ;; string. completion-auto-help 'always ;; Include more information with completion listings completions-detailed t ;; Move focus to the completions window after hitting tab ;; twice. completion-auto-select 'second-tab ;; Cycle through completion options vertically, not ;; horizontally. completions-format 'vertical ;; Sort recently used completions first. completions-sort 'historical ;; Only show up to 10 lines in the completions window. completions-max-height 10 ;; Don't show the unneeded help string at the top of the ;; completions buffer. completion-show-help nil ;; Add more `completion-styles' to improve candidate selection. completion-styles '(basic partial-completion substring initials)) (keymap-set minibuffer-local-map "C-p" #'minibuffer-previous-completion) (keymap-set minibuffer-local-map "C-n" #'minibuffer-next-completion) (completion-preview-mode 1) (electric-pair-mode 1) (setq load-prefer-newer t) (use-package compile-angel :demand t :config (setq compile-angel-verbose nil) (push "/init.el" compile-angel-excluded-files) (push "/early-init.el" compile-angel-excluded-files) (push "/post-init.el" compile-angel-excluded-files) (push "/eshell.el" compile-angel-excluded-files) (push "/gnus.el" compile-angel-excluded-files) (compile-angel-on-load-mode 1)) (use-package paren :ensure nil :hook (after-init-hook . show-paren-mode) :custom (show-paren-delay 0) (show-paren-style 'mixed) (show-paren-context-when-offscreen t)) (use-package guix :ensure nil) (use-package geiser-guile :ensure nil) (use-package rainbow-delimiters :ensure nil :init (rainbow-delimiters-mode)) (use-package pinentry :ensure nil) (use-package pass :ensure nil) (use-package bluetooth :ensure nil) (use-package enwc :ensure nil :init (setq enwc-default-backend 'nm)) (load-file (expand-file-name "gnus.el" user-emacs-directory)) (load-file (expand-file-name "eshell.el" user-emacs-directory)) (server-start)