GithubHelp home page GithubHelp logo

copilot.el's Introduction

Copilot.el

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.

Installation

  1. Install Node.js 12 or newer.

  2. Clone this repo (or install package via straight.el, see example).

  3. Modify your emacs configuration to load and setup copilot.el. (See examples below.)

  4. Login to Copilot by M-x copilot-login. You can also check the status by M-x copilot-diagnose.

  5. Enjoy!

Example Configuration

Spacemacs + company-mode

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))))

Straight

(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)))))

Commands

copilot-diagnose

Check the current status of the plugin.

copilot-login

Login to GitHub, required for using the plugin.

copilot-accept-completion

Accept the current completion. You need to bind this to some key.

copilot-complete

Try to complete at the current point. You need to hook some function to this.

copilot-clear-overlay

Clear copilot overlay in the current buffer. You may need to hook some function to this.

Roadmap

  • Setup Copilot without Neovim
  • Cycle through suggestions
  • Add package to MELPA
  • Test compatibility with vanilla Emacs and other auto completion packages

Thanks

These projects helped me a lot:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.