Enhancing Neovim with Copilot Chat: A New Era of Coding Efficiency

Dung Huynh DucDung Huynh Duc
2 min read

Last month, I wrote a small guide for Copilot Chat with Neovim, an endeavor I didn't expect to revisit. However, the recent introduction of CopilotChatInPlace commands has marked a significant milestone, narrowing the functionality gap with its VSCode extension. This enhancement promises a seamless coding experience, as demonstrated in this demo:

In-place Demo

The Journey of Collaboration

The journey commenced with a productive discussion on my fork at CopilotChat.nvim/discussions/22. A Github user, ziontee113 made an amazing contribution to CopilotChat.nvim. Together with gptlang, we began to merge two new commands: CopilotAgent and CopilotAgentVisual into the plugin.

My project is currently here ziontee113/CopilotAgent.nvimI plan to make this into a super agent that can handle complex coding tasks, hence the name of the derived repo.

CopilotAgent and CopilotAgentVisual is basically like the original CopilotChat, but re-written with some new features.
InplaceHandler purpose is to prompt copilot and replace code in place, like ChatGPT.nvim using popup windows.
I also created new PopUp / Layout modules to handle such tasks like nui.nvim, but in Python.Follow up on the last article

Milestone Achieved:Version 1.0 release

The latest version introduces significant improvements:

  • A simplified architecture that focuses on core logic integrated with minimal Lua for enhanced configuration and standalone features.

  • Unified Python implementations into a single CopilotChat command for streamlined operation.

  • A new UI layout for the InPlace command, facilitating easier management.

  • Added functionalities like folding and token count for Copilot responses.

The Good

The plugin's architecture remains straightforward. Most of the logic (core in Python) implementation communicates with thin Lua code for configuration and standalone features, e.g., spinner, and log.

The Bad

Despite the advancements, issues like Ambiguous use of user-defined command or Empty Command and Ambiguous Use of Command persist due to this plugin being written in Python 3 and the need to run the :UpdateRemotePlugins command to register the CopilotChat command.

To mitigate these challenges, I created wiki/Troubleshooting

The Ugly

Windows users face unique challenges, notably the Ambiguous use of user-defined command' or the inability to register the CopilotChat after running UpdateRemotePlugins. Please let us know if you find a way to resolve this issue. While a solution remains unknown, we encourage the community to share configurations and workarounds in Share your config.

Join Us on Our Journey

To keep abreast of developments and contribute to our evolving roadmap, we invite you to join our Discord community. Your input and collaboration are invaluable as we strive to redefine coding efficiency with Copilot Chat and Neovim.

0
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