#TIL 36 - Github Copilot with NvChad/Nvim

Jan 3, 2023 · Dung Huynh

What

Install and configure GitHub Copilot in Neovim with custom keybindings.

Why

Copilot provides AI-powered code suggestions. Official vim plugin works with Neovim.

How

1. Install plugin (with packer/vim-plug):

use { "github/copilot.vim" }

2. Add to init.lua:

-- Prevent default mappings
vim.g.copilot_assume_mapped = true

-- Custom keybindings
vim.keymap.set("i", "<C-j>", "<Plug>(copilot-next)", { nowait = true })
vim.keymap.set("i", "<C-k>", "<Plug>(copilot-previous)", { nowait = true })
vim.keymap.set("i", "<C-l>", "<Plug>(copilot-suggest)", { nowait = true })

3. Authenticate:

:Copilot setup