How to use Copilot Chat with Neovim!
Table of contents
Intro
If you're a Neovim/Vim user who has been eagerly anticipating Copilot Chat, your wait might be over. There's been significant buzz about it in the community, as evidenced by the numerous comments in this discussion: copilot.vim support for copilot chat? · community · Discussion #50939
Context
A few weeks ago, a new and somewhat unpolished plugin surfaced. It's not an official release from the GitHub team, but rather a community-driven initiative. It caught my attention, and I decided to explore it. Written in Python, integrating this plugin into my Neovim configuration involved copying a few files and running UpdateRemotePlugins, followed by a Neovim restart.
Demo & Usage
For this demonstration, I'll be integrating the plugin using my fork with lazy.nvim:
{
"CopilotC-Nvim/CopilotChat.nvim",
opts = {},
build = function()
vim.cmd("UpdateRemotePlugins") -- You need to restart to make it works
end,
event = "VeryLazy",
keys = {
{ "<leader>cce", "<cmd>CopilotChatExplain<cr>", desc = "CopilotChat - Explain code" },
{ "<leader>cct", "<cmd>CopilotChatTests<cr>", desc = "CopilotChat - Generate tests" },
},
}
To use it, simply yank code into the unnamed register and run CopilotChat
to open a new buffer for an interactive chat session.
Roadmap and Future Enhancements
This plugin is still in its early stages, but it shows immense promise. A noteworthy development on the horizon is the addition of sub-commands, a feature requested by me on Feature Request: support sub-commands in CopilotChat.nvim · Issue #5 · gptlang/CopilotChat.nvim. The author has acknowledged this request and plans to implement it soon, which is expected to significantly enhance the plugin's functionality and user experience.
Your feedback and trials are essential to its evolution, so I encourage you to give it a try and contribute to its ongoing development.
Subscribe to my newsletter
Read articles from Dung Huynh Duc directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Dung Huynh Duc
Dung Huynh Duc
Hi 👋, I'm Dung Huynh Duc A passionate engineer from Singapore 🔭 I’m currently working in AirCarbon 👨💻 All of my projects are available at https://productsway.com 📝 I regularly write articles on https://productsway.com 📫 How to reach me dung@productsway.com 📹 I often publish my video every Sunday on IT Man Channel