Commit 8245bab3c9ff

Vincent Demeester <vincent@sbr.pm>
2025-11-17 22:43:38
tools/emacs: configure abbrev for quick completion
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 73bbd30
Changed files (1)
tools
emacs
tools/emacs/init.el
@@ -973,6 +973,43 @@ minibuffer, even without explicitly focusing it."
               ("e" . wgrep-change-to-wgrep-mode)
               ("C-x C-q" . wgrep-change-to-wgrep-mode)))
 
+(use-package abbrev
+  :ensure nil
+  :custom
+  (save-abbrevs nil)
+  :config
+  (define-abbrev-table 'global-abbrev-table
+    '(;; Arrows
+      ("ra" "→")
+      ("la" "←")
+      ("ua" "↑")
+      ("da" "↓")
+
+      ;; Emojis for context markers
+      ;; ("todo"  "👷 TODO:")
+      ;; ("fixme" "🔥 FIXME:")
+      ;; ("note"  "📎 NOTE:")
+      ;; ("hack"  "👾 HACK:")
+      ("smile"  "😄")
+      ("party" "🎉")
+      ("up"  "☝️")
+      ("applause" "👏")
+      ("manyapplauses" "👏👏👏👏👏👏👏👏")
+      ("heart" "❤️")
+
+      ;; NerdFonts
+      ("nerdfolder" " ")
+      ("nerdgit" "")
+      ("nerdemacs" "")
+
+      ;; Markdown
+      ("cb" "```@\n\n```"
+       (lambda () (search-backward "@") (delete-char 1)))
+
+      ;; ORG
+      ("ocb" "#+BEGIN_SRC @\n\n#+END_SRC"
+       (lambda () (search-backward "@") (delete-char 1))))))
+
 (use-package tempel
   :custom (tempel-path (expand-file-name "templates" user-emacs-directory))
   :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand