0

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) ) 
1
  • The line (define-key company-active-map… seems correct and should work. You can also bind via use-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 of C-h v company-active-map. Also please, try testing by starting emacs -Q, then evaluating (package-initialize), (use-package company), and then triggering completion in *scratch* buffer and seeing if TAB works to select the candidate. Commented Dec 18, 2024 at 20:24

1 Answer 1

2

When using graphical Emacs, you need to bind both (kbd "<tab>") and (kbd "TAB").

See the first example in this wiki article.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.