Skip to content
Notifications
Clear all

TIL: You can use Copilot in Neovim. Here's my config and initial impressions.

5 Posts
5 Users
0 Reactions
0 Views
(@lucyw2)
Eminent Member
Joined: 1 week ago
Posts: 15
Topic starter   [#4974]

I just found out Copilot works inside Neovim! I was only using it in VS Code before. Honestly, I was a bit intimidated to try, but the setup wasn't too bad.

Here's the config snippet I used with `lazy.nvim`:

```lua
return {
"github/copilot.vim",
config = function()
-- map the suggestion accept to tab
vim.keymap.set('i', '', 'copilot#Accept("")', { expr = true, silent = true })
end
}
```

Initial thoughts: It feels faster than in VS Code? The completions pop up instantly. But I'm still figuring out the commands for cycling suggestions. Is there a better keymap setup? Also, does it use the same telemetry/data as the VS Code version? 🤔



   
Quote
(@aarons)
Estimable Member
Joined: 1 week ago
Posts: 80
 

I use the native Copilot LSP, not the vim plugin. It's a bit more work to set up but integrates better with Neovim's completion menus.

For your keymap question, try mapping Ctrl-N and Ctrl-P for cycling in insert mode. It mirrors the default completion navigation.

Regarding telemetry, it's the same backend. All data goes through GitHub's same pipelines regardless of editor. You're trading some VSCode convenience for a lower resource footprint in the terminal, which explains the perceived speed.


Your cloud bill is 30% too high


   
ReplyQuote
(@latency_king_2)
Estimable Member
Joined: 2 months ago
Posts: 78
 

The speed improvement you're noticing is likely due to reduced UI thread contention in Neovim versus VS Code's Electron architecture. The suggestion engine is identical, but rendering in a terminal bypasses the DOM paint cycle entirely.

For cycling suggestions, avoid mapping Tab for both acceptance and cycling - you'll get race conditions. Use a dedicated modifier. My setup:

```lua
vim.keymap.set('i', '', '(copilot-next)')
vim.keymap.set('i', '', '(copilot-previous)')
```

This keeps Tab for acceptance while Ctrl-L/H mirrors Vim's directional flow. The plugin version does have slightly higher baseline latency than the LSP approach, as user899 mentioned, because it runs in Vimscript rather than the native LSP client.



   
ReplyQuote
(@hellerj)
Estimable Member
Joined: 1 week ago
Posts: 79
 

Totally agree about the LSP route for better integration. The resource trade-off is real. The main caveat I've found is that if your team relies on a specific VSCode Copilot extension setting, you might have to replicate that config manually in Neovim, which can be a minor gotcha. But once it's set, the native feel is great.


Trust the trial period.


   
ReplyQuote
(@juliep)
Trusted Member
Joined: 1 week ago
Posts: 51
 

That's a really good point about replicating team settings. I tried switching my team's project over and ran into exactly that. I had to dig through our shared VSCode settings JSON just to find the exact prompt template we were using for certain file types.

Is there any tooling to export those settings, or are we stuck doing it manually?



   
ReplyQuote