reddit / emacs

Yasnippet with corfu

O10120240501 · 2022-12-21 20:52
Does anyone have an idea how to configure yasnippet so it provides the snippets in completion-at-point and when I select any with corfu it automaticly expands them?
yapfff · 2022-12-22 08:46
You need to use the cape package, as well as the company support for yasnippet. For example, this is what I use to have corfu show possible snippets when using Eglot: (require 'company-yasnippet) (defun my/eglot-cap-config () (setq-local completion-at-point-functions (list (cape-super-capf #'eglot-completion-at-point #'cape-dabbrev (cape-company-to-capf #'company-yasnippet))))) (add-hook 'eglot-managed-mode-hook #'my/eglot-cap-config) As you can see there's nothing to do at the corfu level: corfu will simply pick the completions provided by the configured sources using the generic Emacs completion support. And the tool to combine and reuse completion sources is the cape package.
kosakgroove · 2022-12-31 07:49
I have this working.. but wonder how can I disable auto expansion ? If i type "doc" for example i see the completions in Corfu, but it auto expands the snippet. I would like it to only expand snippet when I press enter.