Skip to main content

Getting started with GitHub Copilot in Neovim

Learn how to install GitHub Copilot in Neovim, and start seeing suggestions as you write comments and code.

GitHub Copilot is available to GitHub customers with a personal account on GitHub.com. GitHub Copilot is free to use for verified students and open source maintainers. If you are not a student or open source maintainer, you can try GitHub Copilot for free with a one-time 60 day trial. After the free trial, you will need a paid subscription for continued use. For more information, see "About billing for GitHub Copilot."

About GitHub Copilot and Neovim

GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. For more information, see "About GitHub Copilot".

If you use a Neovim, you can view and incorporate suggestions from GitHub Copilot directly within the editor.

Prerequisites

To use GitHub Copilot in Neovim you must have Neovim and Node.js version 17 or below installed. For more information, see the Neovim documentation and the Node.js website.

Installing the Neovim extension

  1. To use GitHub Copilot in Neovim, install the GitHub Copilot plugin. You can either install the plugin from a plugin manager or directly.

    • If you use a plugin manager like vim-plug or packer.nvim, use the plugin manager to install github/copilot.vim. For more information, see the documentation for the plugin manager. For example, you can see the documentation for vim-plug or packer.nvim.

    • To install the GitHub Copilot plugin directly, you must know where Neovim stores plugins. To install the plugin, enter the following command in Terminal.

      git clone https://github.com/github/copilot.vim \
         PATH/TO/NEOVIM/PLUGINS/copilot.vim
      
  2. To configure GitHub Copilot, open Neovim and enter the following command.

    :Copilot setup
    
  1. To use GitHub Copilot in Neovim, install the GitHub Copilot plugin. You can either install the plugin from a plugin manager or directly.

    • If you use a plugin manager like vim-plug or packer.nvim, use the plugin manager to install github/copilot.vim. For more information, see the documentation for the plugin manager. For example, you can see the documentation for vim-plug or packer.nvim.

    • To install the GitHub Copilot plugin directly, you must know where Neovim stores plugins. To install the plugin, enter the following command in Git Bash.

      git clone https://github.com/github/copilot.vim \
      ~/.config/PATH/TO/YOUR/NEOVIM/CONFIG/FILE/copilot.vim
      
  2. To configure GitHub Copilot, open Neovim and enter the following command.

    :Copilot setup
    
  1. To use GitHub Copilot in Neovim, install the GitHub Copilot plugin. You can either install the plugin from a plugin manager or directly.

    • If you use a plugin manager like vim-plug or packer.nvim, use the plugin manager to install github/copilot.vim. For more information, see the documentation for the plugin manager. For example, you can see the documentation for vim-plug or packer.nvim.

    • To install the GitHub Copilot plugin directly, you must know where Neovim stores plugins. To install the plugin, enter the following command in Git Bash.

      git clone https://github.com/github/copilot.vim \
      ~/.config/PATH/TO/YOUR/NEOVIM/CONFIG/FILE/copilot.vim
      
  2. To configure GitHub Copilot, open Neovim and enter the following command.

    :Copilot setup
    

Learning to use GitHub Copilot in Neovim

For guidance on using GitHub Copilot in Neovim, you can view the plugin documentation. To see the documentation, open Neovim and run the following command.

:help copilot

Further reading