Fix embark, add tempel
This commit is contained in:
@@ -53,7 +53,7 @@
|
|||||||
;; completion-at-point-functions (Capfs).
|
;; completion-at-point-functions (Capfs).
|
||||||
(use-package cape
|
(use-package cape
|
||||||
:ensure t
|
:ensure t
|
||||||
:defer t
|
:defer nil
|
||||||
:commands (cape-dabbrev cape-file cape-elisp-block)
|
:commands (cape-dabbrev cape-file cape-elisp-block)
|
||||||
:bind ("C-c p" . cape-prefix-map)
|
:bind ("C-c p" . cape-prefix-map)
|
||||||
:init
|
:init
|
||||||
@@ -127,16 +127,17 @@
|
|||||||
|
|
||||||
:init
|
:init
|
||||||
(setq prefix-help-command #'embark-prefix-help-command)
|
(setq prefix-help-command #'embark-prefix-help-command)
|
||||||
(push 'embark--allow-edit
|
|
||||||
(alist-get 'eglot-code-actions embark-target-injection-hooks))
|
|
||||||
(push 'embark--ignore-target
|
|
||||||
(alist-get 'eglot-code-actions embark-target-injection-hooks))
|
|
||||||
:config
|
:config
|
||||||
;; Hide the mode line of the Embark live/completions buffers
|
;; Hide the mode line of the Embark live/completions buffers
|
||||||
(add-to-list 'display-buffer-alist
|
(add-to-list 'display-buffer-alist
|
||||||
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
|
||||||
nil
|
nil
|
||||||
(window-parameters (mode-line-format . none)))))
|
(window-parameters (mode-line-format . none))))
|
||||||
|
(push 'embark--allow-edit
|
||||||
|
(alist-get 'eglot-code-actions embark-target-injection-hooks))
|
||||||
|
(push 'embark--ignore-target
|
||||||
|
(alist-get 'eglot-code-actions embark-target-injection-hooks)))
|
||||||
|
|
||||||
;; This package provides some integrations between the emabrk and
|
;; This package provides some integrations between the emabrk and
|
||||||
;; consult packages.
|
;; consult packages.
|
||||||
|
|||||||
@@ -168,17 +168,45 @@ control codes are not supported."
|
|||||||
(indent-bars-treesit-wrap '((rust arguments parameters)))
|
(indent-bars-treesit-wrap '((rust arguments parameters)))
|
||||||
:hook ((python-base-mode yaml-mode rust-mode) . indent-bars-mode))
|
:hook ((python-base-mode yaml-mode rust-mode) . indent-bars-mode))
|
||||||
|
|
||||||
;; Ellama allows using LLMs from emacs.
|
;; Configure Tempel
|
||||||
(use-package ellama
|
(use-package tempel
|
||||||
:ensure nil
|
:bind (("M-+" . tempel-complete) ;; Alternative tempel-expand
|
||||||
:defer t
|
("M-*" . tempel-insert))
|
||||||
:bind ("C-c e" . ellama)
|
|
||||||
:init (setopt ellama-auto-scroll t)
|
:init
|
||||||
:commands (ellama)
|
|
||||||
:config
|
;; Setup completion at point
|
||||||
;; show ellama context in header line in all buffers
|
(defun tempel-setup-capf ()
|
||||||
(ellama-context-header-line-global-mode +1)
|
;; Add the Tempel Capf to `completion-at-point-functions'. `tempel-expand'
|
||||||
;; show ellama session id in header line in all buffers
|
;; only triggers on exact matches. We add `tempel-expand' *before* the main
|
||||||
(ellama-session-header-line-global-mode +1))
|
;; programming mode Capf, such that it will be tried first.
|
||||||
|
(setq-local completion-at-point-functions
|
||||||
|
(cons #'tempel-expand completion-at-point-functions))
|
||||||
|
|
||||||
|
;; Alternatively use `tempel-complete' if you want to see all matches. Use
|
||||||
|
;; a trigger prefix character in order to prevent Tempel from triggering
|
||||||
|
;; unexpectly.
|
||||||
|
;; (setq-local corfu-auto-trigger "/"
|
||||||
|
;; completion-at-point-functions
|
||||||
|
;; (cons (cape-capf-trigger #'tempel-complete ?/)
|
||||||
|
;; completion-at-point-functions))
|
||||||
|
)
|
||||||
|
|
||||||
|
(add-hook 'conf-mode-hook 'tempel-setup-capf)
|
||||||
|
(add-hook 'prog-mode-hook 'tempel-setup-capf)
|
||||||
|
(add-hook 'text-mode-hook 'tempel-setup-capf)
|
||||||
|
|
||||||
|
(setq tempel-path (concat minimal-emacs-user-directory "templates"))
|
||||||
|
|
||||||
|
;; Optionally make the Tempel templates available to Abbrev,
|
||||||
|
;; either locally or globally. `expand-abbrev' is bound to C-x '.
|
||||||
|
;; (add-hook 'prog-mode-hook #'tempel-abbrev-mode)
|
||||||
|
;; (global-tempel-abbrev-mode)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Optional: Add tempel-collection if you want ready-made templates. Yes sir, I
|
||||||
|
;; do.
|
||||||
|
(use-package tempel-collection)
|
||||||
|
|
||||||
|
|
||||||
;;; 15-lsp.el end here
|
;;; 15-lsp.el end here
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@
|
|||||||
!post-init.el
|
!post-init.el
|
||||||
!.config.d/
|
!.config.d/
|
||||||
!.config.d/*
|
!.config.d/*
|
||||||
|
!templates
|
||||||
|
|||||||
Reference in New Issue
Block a user