0

How can I make Dabbrev and Corfu automatically show a pop-up for the words from my current buffer? For example, if I write "example" somewhere in a document, I would like it pops up automatically when I start writing "exa". I have Corfu-global-mode corfu-pop-up mode and Corfu-history enabled.

However, this popup suggestion works perfectly on org-mode! For any other modes, it just does not work. It would be very helpful to get it to work for other modes, especially for Latex mode and Python mode!

Please let me know. Thanks a lot for your help.

Here is my config for corfu:

(use-package corfu
    :custom
    (corfu-cycle t)                 ; Allows cycling through candidates
    (corfu-auto t)                  ; Enable auto completion
    (corfu-auto-prefix 2)
    (corfu-auto-delay 0.1)
    (corfu-popupinfo-delay '(0.4 . 0.2))
    (corfu-preview-current 'insert) ; Do not preview current candidate
    (corfu-preselect-first nil)
    (corfu-on-exact-match nil)      ; Don't auto expand tempel snippets

    :bind (:map corfu-map
                ("M-SPC"      . corfu-insert-separator)
                ("TAB"        . corfu-next)
                ([tab]        . corfu-next)
                ("S-TAB"      . corfu-previous)
                ([backtab]    . corfu-previous)
                ("S-<return>" . nil) ;; leave my entry as it is
                ("RET"        . corfu-insert))

    :init
       (global-corfu-mode)
       (corfu-history-mode)
       (corfu-popupinfo-mode) ; Popup completion info
    )
  (add-hook 'tex-mode-hook #'corfu-mode)
  (add-hook 'LaTeX-mode-hook #'corfu-mode)
sm10
  • 1

1 Answers1

0

It seems the issue was with Eglot in prog mode. I had to add cape-dabbrev to eglot-managed-hook as a cape-super-capf in addition to adding cape-dabbrev to the completion-at-point-functions list.

(defun my/eglot-capf ()
(setq-local completion-at-point-functions
(list (cape-super-capf
#'cape-dabbrev
#'eglot-completion-at-point (cape-company-to-capf #'company-yasnippet)
#'tempel-expand
#'cape-file
))))
(add-hook 'eglot-managed-mode-hook #'my/eglot-capf)

I hope this helps anyone who might be struggling with the issue!

sm10
  • 1