From 58fb83c98eac32fc77710ee2f6bcfb3a86f7b6fb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 4 Oct 2022 02:03:03 +0200 Subject: [PATCH] fix(company): completing-read interface on C-S-s C-S-s while company is completing shoudl bring up the results in your completion framework of choice (ivy, helm, vertico, etc), but failed to do so for vertico (for any completion backend besides company-capf perhaps). --- modules/completion/company/autoload.el | 15 +++++++++++++++ modules/config/default/+evil-bindings.el | 4 +--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/modules/completion/company/autoload.el b/modules/completion/company/autoload.el index 4d006a2c8..cee6855ce 100644 --- a/modules/completion/company/autoload.el +++ b/modules/completion/company/autoload.el @@ -155,3 +155,18 @@ C-x C-l." (let ((company-selection-wrap-around t)) (call-interactively #'+company/dabbrev) (company-select-previous-or-abort))) + +;;;###autoload +(defun +company/completing-read () + "Complete current company candidates in minibuffer. + +Uses ivy, helm, vertico, or ido, if available." + (interactive) + (cond ((modulep! :completion ivy) + (call-interactively #'counsel-company)) + ((modulep! :completion helm) + (call-interactively #'helm-company)) + ((not company-candidates) + (user-error "No company candidates available")) + ((when-let (cand (completing-read "Candidate: " company-candidates)) + (company-finish cand))))) diff --git a/modules/config/default/+evil-bindings.el b/modules/config/default/+evil-bindings.el index 7a34fd63c..a0235f03c 100644 --- a/modules/config/default/+evil-bindings.el +++ b/modules/config/default/+evil-bindings.el @@ -142,9 +142,7 @@ "C-u" #'company-previous-page "C-d" #'company-next-page "C-s" #'company-filter-candidates - "C-S-s" (cond ((modulep! :completion vertico) #'completion-at-point) - ((modulep! :completion ivy) #'counsel-company) - ((modulep! :completion helm) #'helm-company)) + "C-S-s" #'+company/completing-read "C-SPC" #'company-complete-common "TAB" #'company-complete-common-or-cycle [tab] #'company-complete-common-or-cycle