|
4 | 4 | 1. copilot.lua *copilot-copilot.lua*
|
5 | 5 |
|
6 | 6 | This plugin is the pure lua replacement for github/copilot.vim
|
7 |
| -<https://github.com/github/copilot.vim>. |
| 7 | +<https://github.com/github/copilot.vim>. A huge thank you to @tris203 for the |
| 8 | +code behind the nes functionality (copilot-lsp |
| 9 | +<https://github.com/copilotlsp-nvim/copilot-lsp>). |
8 | 10 |
|
9 | 11 | Motivation behind `copilot.lua` ~
|
10 | 12 |
|
@@ -50,7 +52,11 @@ Install the plugin with your preferred plugin manager. For example, with
|
50 | 52 | packer.nvim <https://github.com/wbthomason/packer.nvim>:
|
51 | 53 |
|
52 | 54 | >lua
|
53 |
| - use { "zbirenbaum/copilot.lua" } |
| 55 | + use { "zbirenbaum/copilot.lua" |
| 56 | + requires = { |
| 57 | + "copilotlsp-nvim/copilot-lsp", -- (optional) for NES functionality |
| 58 | + }, |
| 59 | + } |
54 | 60 | <
|
55 | 61 |
|
56 | 62 |
|
@@ -95,6 +101,9 @@ you lazy load copilot. For example:
|
95 | 101 | >lua
|
96 | 102 | use {
|
97 | 103 | "zbirenbaum/copilot.lua",
|
| 104 | + requires = { |
| 105 | + "copilotlsp-nvim/copilot-lsp", -- (optional) for NES functionality |
| 106 | + }, |
98 | 107 | cmd = "Copilot",
|
99 | 108 | event = "InsertEnter",
|
100 | 109 | config = function()
|
@@ -137,16 +146,14 @@ Default configuration ~
|
137 | 146 | dismiss = "<C-]>",
|
138 | 147 | },
|
139 | 148 | },
|
140 |
| - filetypes = { |
141 |
| - yaml = false, |
142 |
| - markdown = false, |
143 |
| - help = false, |
144 |
| - gitcommit = false, |
145 |
| - gitrebase = false, |
146 |
| - hgcommit = false, |
147 |
| - svn = false, |
148 |
| - cvs = false, |
149 |
| - ["."] = false, |
| 149 | + nes = { |
| 150 | + enabled = false, -- requires copilot-lsp as a dependency |
| 151 | + auto_trigger = false, |
| 152 | + keymap = { |
| 153 | + accept_and_goto = false, |
| 154 | + accept = false, |
| 155 | + dismiss = false, |
| 156 | + }, |
150 | 157 | },
|
151 | 158 | auth_provider_url = nil, -- URL to authentication provider, if not "https://github.com/"
|
152 | 159 | logger = {
|
@@ -273,6 +280,49 @@ These can also be accessed through the `:Copilot suggestion <function>` command
|
273 | 280 | (eg. `:Copilot suggestion accept`).
|
274 | 281 |
|
275 | 282 |
|
| 283 | +NES (NEXT EDIT SUGGESTION) ~ |
| 284 | + |
| 285 | + |
| 286 | + [!WARNING] This feature is still experimental and may not work as expected in |
| 287 | + all scenarios, please report any issues you encounter. |
| 288 | +When `enabled` is `true`, copilot will provide suggestions based on the next |
| 289 | +edit you are likely to make, through copilot-lsp |
| 290 | +<https://github.com/copilotlsp-nvim/copilot-lsp>. If there is no suggestion, |
| 291 | +the keymaps will pass through the original keymap. |
| 292 | + |
| 293 | +`copilot-lsp` has a few configurations built-in as well, for additional |
| 294 | +configurations, please refer to the copilot-lsp documentation |
| 295 | +<https://github.com/copilotlsp-nvim/copilot-lsp/blob/main/README.md>. These |
| 296 | +configurations should be set in the `init` function of the `copilot-lsp` |
| 297 | +dependency. |
| 298 | + |
| 299 | +>lua |
| 300 | + use { |
| 301 | + "zbirenbaum/copilot.lua", |
| 302 | + requires = { |
| 303 | + "copilotlsp-nvim/copilot-lsp", |
| 304 | + init = function() |
| 305 | + vim.g.copilot_nes_debounce = 500 |
| 306 | + end, |
| 307 | + }, |
| 308 | + cmd = "Copilot", |
| 309 | + event = "InsertEnter", |
| 310 | + config = function() |
| 311 | + require("copilot").setup({ |
| 312 | + nes = { |
| 313 | + enabled = true, |
| 314 | + keymap = { |
| 315 | + accept_and_goto = "<leader>p", |
| 316 | + accept = false, |
| 317 | + dismiss = "<Esc>", |
| 318 | + }, |
| 319 | + }, |
| 320 | + }) |
| 321 | + end, |
| 322 | + } |
| 323 | +< |
| 324 | + |
| 325 | + |
276 | 326 | FILETYPES ~
|
277 | 327 |
|
278 | 328 | Specify filetypes for attaching copilot.
|
@@ -508,6 +558,11 @@ Set the same for copilot in `server_opts_overrides`:
|
508 | 558 |
|
509 | 559 | Refer to your plugins documentation for changes.
|
510 | 560 |
|
| 561 | +============================================================================== |
| 562 | +2. Links *copilot-links* |
| 563 | + |
| 564 | +1. *@tris203*: |
| 565 | + |
511 | 566 | Generated by panvimdoc <https://github.com/kdheepak/panvimdoc>
|
512 | 567 |
|
513 | 568 | vim:tw=78:ts=8:noet:ft=help:norl:
|
0 commit comments