When company-mode pops up suggestions, I want to use C-n and C-p to select the next or the previous options, instead of M-n and M-p.
Having found the general answer on this site, I was happy to try it out, but it turns out that doesn't work for me. I suspect this is because I have Evil mode enabled.
When I'm in evil-insert-mode, pressing C-h k C-n tells me:
C-n runs the command evil-next-line (found in evil-insert-state-map), which is an interactive compiled Lisp function in ‘evil-commands.el’. It is bound to C-n. (evil-next-line &optional COUNT) Move the cursor COUNT lines down. Is there any way I can shadow this correctly in company-active-map?
For completeness, my configuration is:
(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))
(with-eval-after-load 'company (with-eval-after-load 'evil (evil-define-key nil company-active-map (kbd "C-s") #'company-select-next)))(evil-define-key 'insert company-active-map (kbd "C-n") #'company-select-next)