How to Enable, Configure, Use, and Disable GitHub Copilot in Vim

A practical guide to integrating GitHub Copilot into your Vim or Neovim setup — from installation to configuration, usage, and disabling it by default.


🚀 Supercharge your Vim workflow with GitHub Copilot. Here's how to set it up, use it effectively, and disable it when needed.

🛠️ Prerequisites

Before you begin, make sure you have the following:

  • Vim or Neovim
  • Node.js v16+
  • GitHub account with Copilot access
  • A plugin manager (like vim-plug, packer.nvim, or dein.vim)

✅ Enabling GitHub Copilot in Vim

1. Install the Plugin

For vim-plug users, add this to your .vimrc or init.vim:

Plug 'github/copilot.vim'

Then, in Vim:

:source %
:PlugInstall

For packer.nvim (Lua-based):

use 'github/copilot.vim'

Then run:

:PackerSync

2. Authenticate with GitHub

Once the plugin is installed, open Vim and run:

:Copilot setup

This will launch a browser to authenticate your GitHub account. After granting access, you're good to go.


⚙️ Configuring GitHub Copilot

By default, Copilot auto-suggests as you type. If you want more control:

" Disable automatic tab mapping
let g:copilot_no_tab_map = v:true

" Map <C-J> to accept Copilot suggestions
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")

You can remap <C-J> to any other key combo if preferred.


✨ Using GitHub Copilot

Here are the basics of using Copilot in Vim:

  • Accept suggestion: Press Tab or your mapped key (e.g., <C-J>)
  • Dismiss suggestion: Press Esc or keep typing

Enable/disable on demand:

:Copilot enable
:Copilot disable

Check Copilot status:

:Copilot status

Manually trigger suggestions:

:Copilot suggest

🚫 Disabling GitHub Copilot by Default

Want Copilot installed but not active by default? Add this:

let g:copilot_enabled = v:false

Then manually enable it with:

:Copilot enable

Or create keybindings:

nnoremap <leader>ce :Copilot enable<CR>
nnoremap <leader>cd :Copilot disable<CR>

This gives you full control over when Copilot is active.


🔒 Fully Uninstalling GitHub Copilot

If you want to remove Copilot completely:

  1. Delete the plugin reference from your Vim config.
  2. Run your plugin manager's clean command (e.g., :PlugClean).
  3. Remove local auth/config:
rm -rf ~/.config/github-copilot/

🧠 Final Thoughts

GitHub Copilot can be a powerful assistant when used intentionally. In Vim, it's fast, non-intrusive, and fully configurable. Whether you want suggestions on demand or full silence until you call for help, Copilot fits your workflow.