From 198578a2558c7b7c3999d9c8af526c030e716e6a Mon Sep 17 00:00:00 2001 From: kiennq Date: Tue, 2 Apr 2024 09:12:57 -0700 Subject: [PATCH] corfu: show corfu popup when in insertable state (#800) * fix: show corfu popup when in insertable state --- modes/corfu/evil-collection-corfu.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modes/corfu/evil-collection-corfu.el b/modes/corfu/evil-collection-corfu.el index 8c219bd..c76f839 100644 --- a/modes/corfu/evil-collection-corfu.el +++ b/modes/corfu/evil-collection-corfu.el @@ -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'." @@ -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