Copilot.el is an Emacs plugin for GitHub Copilot.
Warning: This plugin is unofficial and based on binaries provided by copilot.vim.
Warning: This plugin is under development.
Note: You need access to Copilot technical preview to use this plugin.
-
Install Node.js 12 or newer.
-
Clone this repo (or install package via
straight.el
, see example). -
Modify your emacs configuration to load and setup
copilot.el
. (See examples below.) -
Login to Copilot by
M-x copilot-login
. You can also check the status byM-x copilot-diagnose
. -
Enjoy!
Inside your dotspacemacs/user-config
:
; Load copilot.el, modify this path to your local path.
(load-file "~/.emacs.d/copilot.el")
; complete by copilot first, then company-mode
(defun my-tab ()
(interactive)
(or (copilot-accept-completion)
(company-indent-or-complete-common nil)))
; modify company-mode behaviors
(with-eval-after-load 'company
; disable inline previews
(delq 'company-preview-if-just-one-frontend company-frontends)
; enable tab completion
(define-key company-mode-map (kbd "<tab>") 'my-tab)
(define-key company-active-map (kbd "<tab>") 'my-tab))
; provide completion when typing
(add-hook 'post-command-hook (lambda ()
(copilot-clear-overlay)
(when (evil-insert-state-p)
(copilot-complete))))
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el"
:files ("dist" "copilot.el"))
:ensure t
:config
; provide completion when typing
(add-hook 'post-command-hook (lambda ()
(copilot-clear-overlay)
(when (evil-insert-state-p)
(copilot-complete)))))
Check the current status of the plugin.
Login to GitHub, required for using the plugin.
Accept the current completion. You need to bind this to some key.
Try to complete at the current point. You need to hook some function to this.
Clear copilot overlay in the current buffer. You may need to hook some function to this.
- Setup Copilot without Neovim
- Cycle through suggestions
- Add package to MELPA
- Test compatibility with vanilla Emacs and other auto completion packages
These projects helped me a lot: