summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2024-04-24 18:53:09 +0200
committerAlan Pearce2024-04-24 18:53:09 +0200
commite38fee1693ed284c283d92a4d7db00ad3280e86f (patch)
tree395eb58156e932e139929a82697f0f9ab9077ec2 /user/emacs
parent2276c22e9582f80127b497de16fe115a90263771 (diff)
downloadnixfiles-e38fee1693ed284c283d92a4d7db00ad3280e86f.tar.lz
nixfiles-e38fee1693ed284c283d92a4d7db00ad3280e86f.tar.zst
nixfiles-e38fee1693ed284c283d92a4d7db00ad3280e86f.zip
emacs: use tempel for snippet expansion
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el30
1 files changed, 26 insertions, 4 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 07d77b33..268a71d3 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -404,8 +404,7 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
   :demand t
   :config (progn
             (setq evil-collection-magit-use-y-for-yank nil
-                  evil-collection-corfu-key-themes '(tab-n-go
-                                                     magic-return))
+                  evil-collection-corfu-key-themes '(default magic-return))
             (general-unbind 'normal magit-mode-map
               "<escape>")
             (evil-collection-init)))
@@ -527,7 +526,9 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
             (global-corfu-mode +1)
             (setq corfu-auto t
                   corfu-auto-delay 0.1
-                  corfu-auto-prefix 3)
+                  corfu-auto-prefix 3
+                  corfu-on-exact-match nil
+                  corfu-preselect 'valid)
             (defun corfu-enable-in-minibuffer ()
               "Enable Corfu in the minibuffer if `completion-at-point' is bound."
               (when (where-is-internal #'completion-at-point (list (current-local-map)))
@@ -572,6 +573,15 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
 
           (add-hook 'kill-emacs-hook #'tabnine-kill-process)))
 
+(use-package tempel
+  :bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
+         ("M-*" . tempel-insert))
+  :config (progn
+            (global-tempel-abbrev-mode +1)))
+
+(use-package tempel-collection
+  :after tempel)
+
 ;;; Documentation
 
 (use-package eldoc
@@ -1056,7 +1066,19 @@ _C-k_: prev  _u_pper              _=_: upper/lower       _s_mart resolve
             (setq-default eglot-workspace-configuration
                           '(:yaml (:keyOrdering nil)
                                   :nix (:autoArchive t))
-                          eglot-ignored-server-capabilities '(:documentHighlightProvider))))
+                          eglot-ignored-server-capabilities '(:documentHighlightProvider))
+            (defun my/eglot-capf ()
+              (setq-local completion-at-point-functions
+                          (list (cape-capf-super
+                                 #'eglot-completion-at-point
+                                 #'tempel-expand
+                                 #'cape-file))))
+            (add-hook 'eglot-managed-mode-hook #'my/eglot-capf)))
+
+(use-package eglot-tempel
+  :after eglot
+  :config (progn
+            (eglot-tempel-mode +1)))
 
 (use-package consult-eglot
   :commands (consult-eglot-symbols)