12

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.

1 Answer 1

23

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)) 
2
  • 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? Commented Nov 2, 2014 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. Commented Nov 2, 2014 at 11:18

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.