Cancel previous company popup when invoking another
Enables uses to switch between backends, e.g. C-x C-s followed by C-x C-n in insert mode.
This commit is contained in:
parent
ef8cd55234
commit
683683736d
1 changed files with 9 additions and 2 deletions
|
@ -21,9 +21,16 @@
|
|||
(unless (featurep! :editor evil)
|
||||
(add-transient-hook! 'post-self-insert-hook (require 'company)))
|
||||
:config
|
||||
(add-hook 'company-mode-hook #'+company|init-backends)
|
||||
(when (featurep! :editor evil)
|
||||
(add-hook 'company-mode-hook #'evil-normalize-keymaps))
|
||||
(add-hook 'company-mode-hook #'evil-normalize-keymaps)
|
||||
|
||||
;; Allow users to switch between backends on the fly. E.g. C-x C-s followed
|
||||
;; by C-x C-n, will switch from `company-yasnippet' to
|
||||
;; `company-dabbrev-code'.
|
||||
(defun +company*abort-previous (&rest _) (company-abort))
|
||||
(advice-add #'company-begin-backend :before #'+company*abort-previous))
|
||||
|
||||
(add-hook 'company-mode-hook #'+company|init-backends)
|
||||
(global-company-mode +1))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue