parent
5016959285
commit
8574309997
|
@ -33,6 +33,7 @@
|
||||||
(declare-function company-tng-mode "company-tng")
|
(declare-function company-tng-mode "company-tng")
|
||||||
(declare-function company-grab-line "company")
|
(declare-function company-grab-line "company")
|
||||||
(declare-function company-begin-backend "company")
|
(declare-function company-begin-backend "company")
|
||||||
|
(declare-function company-ensure-emulation-alist "company")
|
||||||
|
|
||||||
(defgroup evil-collection-company nil
|
(defgroup evil-collection-company nil
|
||||||
"Evil bindings for `company-mode'."
|
"Evil bindings for `company-mode'."
|
||||||
|
@ -45,6 +46,13 @@
|
||||||
"The \='evil-company-extended' keybindings should be requested"
|
"The \='evil-company-extended' keybindings should be requested"
|
||||||
:type 'boolean)
|
:type 'boolean)
|
||||||
|
|
||||||
|
(defcustom evil-collection-company-enable-keymap-protection t
|
||||||
|
"Prevent evil from breaking company completion keymap.
|
||||||
|
When non-nil, prevents evil from overriding `company-active-map'
|
||||||
|
after calling `company-doc-buffer'. If disabled, the completion
|
||||||
|
keymap will be in a broken state."
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
(defvar company-active-map)
|
(defvar company-active-map)
|
||||||
(defvar company-search-map)
|
(defvar company-search-map)
|
||||||
|
|
||||||
|
@ -58,6 +66,12 @@
|
||||||
(memq evil-state evil-collection-company-supported-states))
|
(memq evil-state evil-collection-company-supported-states))
|
||||||
(t t)))
|
(t t)))
|
||||||
|
|
||||||
|
(defun evil-collection-company-protect-keymap ()
|
||||||
|
"Prevent evil from overriding `company-mode' completion keymap."
|
||||||
|
(when (and evil-collection-company-enable-keymap-protection
|
||||||
|
(memq 'company-emulation-alist emulation-mode-map-alists))
|
||||||
|
(company-ensure-emulation-alist)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun evil-collection-company-whole-lines (command &optional arg &rest _ignored)
|
(defun evil-collection-company-whole-lines (command &optional arg &rest _ignored)
|
||||||
"`company-mode' completion backend that completes whole-lines, akin to vim's
|
"`company-mode' completion backend that completes whole-lines, akin to vim's
|
||||||
|
@ -112,6 +126,9 @@ C-x C-l."
|
||||||
(kbd "M-k") 'company-select-previous
|
(kbd "M-k") 'company-select-previous
|
||||||
(kbd "<escape>") 'company-search-abort)
|
(kbd "<escape>") 'company-search-abort)
|
||||||
|
|
||||||
|
;; https://github.com/emacs-evil/evil-collection/issues/664
|
||||||
|
(add-hook 'evil-local-mode-hook #'evil-collection-company-protect-keymap)
|
||||||
|
|
||||||
;; Make `company-mode' not show popup when not in supported state
|
;; Make `company-mode' not show popup when not in supported state
|
||||||
(advice-add 'company-call-backend
|
(advice-add 'company-call-backend
|
||||||
:before-while 'evil-collection-company-supported-p))
|
:before-while 'evil-collection-company-supported-p))
|
||||||
|
|
Loading…
Reference in New Issue