Skip to content

Commit

Permalink
corfu: show corfu popup when in insertable state (#800)
Browse files Browse the repository at this point in the history
* fix: show corfu popup when in insertable state
  • Loading branch information
kiennq authored Apr 2, 2024
1 parent 89aea40 commit 198578a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modes/corfu/evil-collection-corfu.el
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ This key theme variable may be refactored in the future so use with caution."
(const
:tag "Magic Backspace" magic-backspace))))

(defcustom evil-collection-corfu-supported-states '(insert replace emacs)
"The `evil-state's which `corfu' function can be requested."
:type '(repeat symbol))

;;;###autoload
(defun evil-collection-corfu-setup ()
"Set up `evil' bindings for `corfu'."
Expand Down Expand Up @@ -129,7 +133,9 @@ This key theme variable may be refactored in the future so use with caution."
(kbd "C-u") 'corfu-scroll-down))

(advice-add 'corfu--setup :after (lambda (&rest _) (evil-normalize-keymaps)))
(advice-add 'corfu--teardown :after (lambda (&rest _) (evil-normalize-keymaps))))
(advice-add 'corfu--teardown :after (lambda (&rest _) (evil-normalize-keymaps)))
(advice-add 'corfu--continue-p
:before-while (lambda (&rest _) (memq evil-state evil-collection-corfu-supported-states))))

(provide 'evil-collection-corfu)
;;; evil-collection-corfu.el ends here

0 comments on commit 198578a

Please sign in to comment.