feat(corfu): add +corfu/toggle-auto-complete command
This commit is contained in:
parent
cea17bbea3
commit
4a4a9a1ada
1 changed files with 14 additions and 0 deletions
|
@ -46,4 +46,18 @@
|
|||
(let ((cape-dabbrev-check-other-buffers nil))
|
||||
(cape-dabbrev t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu/toggle-auto-complete (&optional interactive)
|
||||
"Toggle as-you-type completion in Corfu."
|
||||
(interactive (list 'interactive))
|
||||
(dolist (buf (buffer-list))
|
||||
(with-current-buffer buf
|
||||
(when corfu-mode
|
||||
(if corfu-auto
|
||||
(remove-hook 'post-command-hook #'corfu--auto-post-command 'local)
|
||||
(add-hook 'post-command-hook #'corfu--auto-post-command nil 'local)))))
|
||||
(when interactive
|
||||
(message "Corfu auto-complete %s" (if corfu-auto "disabled" "enabled")))
|
||||
(setq corfu-auto (not corfu-auto)))
|
||||
|
||||
;;; end of autoload.el
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue