10

I don't like the default M-n and M-p keys for company-select-next and company-select-previous so I was wondering if it's possible to remap those to C-n and C-p without affecting the mappings when company's tooltip is not active.

21

Modify company-active-map accordingly:

(with-eval-after-load 'company
  (define-key company-active-map (kbd "M-n") nil)
  (define-key company-active-map (kbd "M-p") nil)
  (define-key company-active-map (kbd "C-n") #'company-select-next)
  (define-key company-active-map (kbd "C-p") #'company-select-previous))
  • Do you know why do I get Symbol's value as variable is void: company-active-map after modifying company-active-map, and how can I avoid this? – caisah Nov 2 '14 at 11:11
  • 7
    company-active-map is not defined before company is loaded obviously. You need to evaluate these commands after company was loaded, e.g. with with-eval-after-load. I updated my answer accordingly. – lunaryorn Nov 2 '14 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.