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.
Asked
Active
Viewed 4,119 times
12
1 Answers
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))
-
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 02 '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. – Nov 02 '14 at 11:18