I’d like to define keys in company with evil. Specifically, I’d like to have completion with the TAB key (because I am used to that from other applications). I have tried multiple variants of the following, but could not get it working. Any help appreciated – thank you!
(use-package company ; … :init (global-company-mode) :config (evil-define-key '(normal insert visual) company-active-map (kbd "<TAB>") 'company-complete-selection) (define-key company-active-map (kbd "<TAB>") 'company-complete-selection) (define-key company-search-map (kbd "<TAB>") 'company-complete-selection) (define-key company-mode-map (kbd "<TAB>") 'company-complete-selection) )
(define-key company-active-map…seems correct and should work. You can also bind viause-package's built-in means; but I think all of that is orthogonal to your problem, because TAB is by default bound to insert the current candidate, and the fact that it is different for you hints something else is going on. Please, show the output ofC-h v company-active-map. Also please, try testing by startingemacs -Q, then evaluating(package-initialize),(use-package company), and then triggering completion in*scratch*buffer and seeing if TAB works to select the candidate.