LoginSignup
1
2

More than 5 years have passed since last update.

company-modeの補完候補の移動をCtrl-nとCtrl-pでやりたい

Posted at

私はEmacs+Goの環境でcompany-modeを利用して補完の候補を出しているのですが、この候補を選ぼうとしてCtrl-nで移動できないのにイライラしていました。

image.png

M-n/M-pで移動するのが正解らしいのですが、そんなキーバインドがデフォルトというのは解せませんね。

これをCtrl-n/Ctrl-pで移動するようにするのは簡単で、次のように.emacsに書くだけです。

+;;; Remap company-select-next and company-select-previous to C-n and C-p
+;;; via: https://emacs.stackexchange.com/questions/2988/how-to-remap-companys-select-next-and-select-previous-keys
+(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))

元ネタ

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2