Skip to content

Instantly share code, notes, and snippets.

@jmftrindade
Last active March 23, 2023 02:22
Show Gist options
  • Save jmftrindade/15651025818fb877df71d93401fefb5d to your computer and use it in GitHub Desktop.
Save jmftrindade/15651025818fb877df71d93401fefb5d to your computer and use it in GitHub Desktop.
Install + setup github Copilot for Neovim on Ubuntu

Assumes:

  1. You already have access to github's Copilot (Copilot Chat is not yet available for neovim as of Mar 22nd 2023).
  2. Ubuntu 20.04+ (should work for other Debian distros as well).
  3. If you were using vim before, that your .vimrc does not rely on features that are not supported by neovim. I use powerline and YouCompleteme for vim, which don't vibe with neovim, so I had to make a couple of changes to my .vimrc. Take a look at this commit for an example on how to do that.

Step 1 - Install Neovim

Docs

The version on Ubuntu 20.04's package manager was deemed "too old" by Copilot, so I had to do the following:

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim.appimage
chmod u+x nvim.appimage
./nvim.appimage  # symlink and update $PATH accordingly 

Setup neovim's config file:

mkdir -p ~/.config/nvim
touch ~/.config/nvim/init.vim

Add the following to ~/.config/nvim/init.vim if you want to reuse your .vimrc:

set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc

Step 2 - Install NodeJS

Docs

curl -fsSL https://deb.nodesource.com/setup_19.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Step 3 - Configure Copilot

Docs

git clone https://github.com/github/copilot.vim \
   ~/.config/nvim/pack/github/start/copilot.vim

And on neovim, follow the prompts for setting up access to your github:

:Copilot setup
:Copilot enable

To check status (should say Copilot: Enabled and online):

:Copilot status

Then once you're on neovim, start typing away, using TAB to accept Copilot's suggestions.

Step 4 - Neovim keybindings (Optional)

Example bindings for a 65% keyboard (Reddit): Example bindings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment