1
1
if vim .g .avante_provider == " copilot" or vim .g .avante_auto_suggestions_provider == " copilot" then
2
- vim .cmd [[ echoerr "DO NOT USE third-party Copilot extensions!!!"]]
2
+ vim .cmd (
3
+ [[ echoerr 'DO NOT USE third-party Copilot extensions!!! See: https://github.com/yetone/avante.nvim/issues/557 and https://github.com/zbirenbaum/copilot-cmp/issues/117']]
4
+ )
3
5
return nil
4
6
end
7
+ -- WARN: DO NOT USE
8
+ -- - copilot.lua
9
+ -- - copilot-cmp
10
+ -- - avante.nvim with copilot provider
11
+ -- See: https://support.github.com/ticket/personal/0/3165529
5
12
6
- local copilot_lua = {
7
- " zbirenbaum/copilot.lua" ,
8
- event = " InsertEnter" ,
9
- config = function ()
10
- require (" copilot" ).setup ({
11
- suggestion = {
12
- enabled = (vim .avante_auto_suggestions_enabled == 0 ),
13
- auto_trigger = true ,
14
- hide_during_completion = false ,
15
- debounce = 75 ,
16
- keymap = {
17
- accept = false ,
18
- accept_word = " <M-w>" ,
19
- accept_line = " <M-l>" ,
20
- next = " <M-]>" ,
21
- prev = " <M-[>" ,
22
- dismiss = " <C-]>" ,
23
- },
24
- },
25
- })
26
- vim .keymap .set (" i" , " <Tab>" , function ()
27
- if require (" copilot.suggestion" ).is_visible () then
28
- require (" copilot.suggestion" ).accept ()
29
- else
30
- vim .api .nvim_feedkeys (vim .api .nvim_replace_termcodes (" <Tab>" , true , false , true ), " n" , false )
31
- end
32
- end , { desc = " Super Tab" })
33
- end ,
34
- }
35
-
36
- local copilot_chat = {
37
- " CopilotC-Nvim/CopilotChat.nvim" ,
38
- lazy = true ,
39
- dependencies = {
40
- -- { "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
41
- { " zbirenbaum/copilot.lua" },
42
- { " nvim-lua/plenary.nvim" , branch = " master" }, -- for curl, log and async functions
43
- },
44
- build = " make tiktoken" , -- Only on MacOS or Linux
45
- cmd = {
46
- " CopilotChat" ,
47
- " CopilotChatAgents" ,
48
- " CopilotChatClose" ,
49
- " CopilotChatCommit" ,
50
- " CopilotChatCommitStaged" ,
51
- " CopilotChatDebugInfo" ,
52
- " CopilotChatDocs" ,
53
- " CopilotChatExplain" ,
54
- " CopilotChatFix" ,
55
- " CopilotChatFixDiagnostic" ,
56
- " CopilotChatLoad" ,
57
- " CopilotChatModels" ,
58
- " CopilotChatOpen" ,
59
- " CopilotChatOptimize" ,
60
- " CopilotChatReset" ,
61
- " CopilotChatTests" ,
62
- " CopilotChatToggle" ,
63
- },
64
- opts = {
65
- debug = true , -- Enable debugging
66
- -- See Configuration section for rest
67
- },
68
- -- See Commands section for default commands if you want to lazy load on them
69
- }
13
+ -- local copilot_lua = {
14
+ -- "zbirenbaum/copilot.lua",
15
+ -- event = "InsertEnter",
16
+ -- config = function()
17
+ -- require("copilot").setup({
18
+ -- suggestion = {
19
+ -- enabled = true,
20
+ -- auto_trigger = true,
21
+ -- hide_during_completion = false,
22
+ -- debounce = 75,
23
+ -- keymap = {
24
+ -- accept = false,
25
+ -- accept_word = "<M-w>",
26
+ -- accept_line = "<M-l>",
27
+ -- next = "<M-]>",
28
+ -- prev = "<M-[>",
29
+ -- dismiss = "<C-]>",
30
+ -- },
31
+ -- },
32
+ -- })
33
+ -- vim.keymap.set("i", "<Tab>", function()
34
+ -- if require("copilot.suggestion").is_visible() then
35
+ -- require("copilot.suggestion").accept()
36
+ -- else
37
+ -- vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Tab>", true, false, true), "n", false)
38
+ -- end
39
+ -- end, { desc = "Super Tab" })
40
+ -- end,
41
+ -- }
70
42
71
43
local deepseek_api = {
72
44
endpoint = " https://api.deepseek.com/v1" ,
@@ -76,92 +48,125 @@ local deepseek_api = {
76
48
max_tokens = 4096 ,
77
49
}
78
50
79
- local plugins = {
80
- copilot = {
81
- copilot_chat ,
82
- -- "github/copilot.vim",
83
- copilot_lua ,
84
- -- https://github.com/magicalne/nvim.ai
85
- -- {
86
- -- "olimorris/codecompanion.nvim",
87
- -- dependencies = {
88
- -- "nvim-lua/plenary.nvim",
89
- -- "nvim-treesitter/nvim-treesitter",
90
- -- "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer
91
- -- "nvim-telescope/telescope.nvim", -- Optional: For working with files with slash commands
92
- -- -- {
93
- -- -- "stevearc/dressing.nvim", -- Optional: Improves the default Neovim UI
94
- -- -- opts = {},
95
- -- -- },
96
- -- },
97
- -- config = true
98
- -- },
51
+ return {
52
+ {
53
+ " CopilotC-Nvim/CopilotChat.nvim" ,
54
+ lazy = true ,
55
+ cond = vim .g .ai_suggestion == " copilot.vim" ,
56
+ dependencies = {
57
+ { " github/copilot.vim" }, -- or zbirenbaum/copilot.lua
58
+ { " nvim-lua/plenary.nvim" , branch = " master" }, -- for curl, log and async functions
59
+ },
60
+ build = " make tiktoken" , -- Only on MacOS or Linux
61
+ cmd = {
62
+ " CopilotChat" ,
63
+ " CopilotChatAgents" ,
64
+ " CopilotChatClose" ,
65
+ " CopilotChatCommit" ,
66
+ " CopilotChatCommitStaged" ,
67
+ " CopilotChatDebugInfo" ,
68
+ " CopilotChatDocs" ,
69
+ " CopilotChatExplain" ,
70
+ " CopilotChatFix" ,
71
+ " CopilotChatFixDiagnostic" ,
72
+ " CopilotChatLoad" ,
73
+ " CopilotChatModels" ,
74
+ " CopilotChatOpen" ,
75
+ " CopilotChatOptimize" ,
76
+ " CopilotChatReset" ,
77
+ " CopilotChatTests" ,
78
+ " CopilotChatToggle" ,
79
+ },
80
+ opts = {
81
+ debug = true , -- Enable debugging
82
+ -- See Configuration section for rest
83
+ },
84
+ -- See Commands section for default commands if you want to lazy load on them
99
85
},
100
- [" avante.nvim" ] = {
101
- {
102
- " yetone/avante.nvim" ,
103
- event = " VeryLazy" ,
104
- lazy = true ,
105
- version = false , -- set this if you want to always pull the latest change
106
- opts = { -- add any opts here
107
- debug = false ,
108
- provider = vim .g .avante_provider ,
109
- auto_suggestions_provider = vim .g .avante_auto_suggestions_provider ,
110
- openai = deepseek_api ,
111
- behaviour = {
112
- auto_suggestions = vim .g .avante_auto_suggestions_enabled == 1 , -- Experimental stage
113
- },
114
- mappings = {
115
- suggestion = {
116
- accept = " <Tab>" ,
117
- next = " <M-]>" ,
118
- prev = " <M-[>" ,
119
- dismiss = " <C-]>" ,
120
- },
121
- },
86
+ -- https://github.com/magicalne/nvim.ai
87
+ -- {
88
+ -- "olimorris/codecompanion.nvim",
89
+ -- dependencies = {
90
+ -- "nvim-lua/plenary.nvim",
91
+ -- "nvim-treesitter/nvim-treesitter",
92
+ -- "hrsh7th/nvim-cmp", -- Optional: For using slash commands and variables in the chat buffer
93
+ -- "nvim-telescope/telescope.nvim", -- Optional: For working with files with slash commands
94
+ -- -- {
95
+ -- -- "stevearc/dressing.nvim", -- Optional: Improves the default Neovim UI
96
+ -- -- opts = {},
97
+ -- -- },
98
+ -- },
99
+ -- config = true
100
+ -- },
101
+ {
102
+ " github/copilot.vim" ,
103
+ cond = vim .g .ai_suggestion == " copilot.vim" ,
104
+ },
105
+ {
106
+ " yetone/avante.nvim" ,
107
+ event = " VeryLazy" ,
108
+ lazy = true ,
109
+ version = false , -- set this if you want to always pull the latest change
110
+ opts = { -- add any opts here
111
+ debug = false ,
112
+ provider = vim .g .avante_provider ,
113
+ auto_suggestions_provider = vim .g .avante_auto_suggestions_provider ,
114
+ openai = deepseek_api ,
115
+ behaviour = {
116
+ auto_suggestions = vim .g .ai_suggestion == " avante.nvim" , -- Experimental stage
122
117
},
123
- -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
124
- build = " make" ,
125
- -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
126
- dependencies = {
127
- " stevearc/dressing.nvim" ,
128
- " nvim-lua/plenary.nvim" ,
129
- " MunifTanjim/nui.nvim" ,
130
- --- The below dependencies are optional,
131
- " nvim-tree/nvim-web-devicons" , -- or echasnovski/mini.icons
132
- " zbirenbaum/copilot.lua" , -- for providers='copilot'
133
- -- {
134
- -- -- support for image pasting
135
- -- "HakonHarnes/img-clip.nvim",
136
- -- event = "VeryLazy",
137
- -- opts = {
138
- -- -- recommended settings
139
- -- default = {
140
- -- embed_image_as_base64 = false,
141
- -- prompt_for_file_name = false,
142
- -- drag_and_drop = {
143
- -- insert_mode = true,
144
- -- },
145
- -- -- required for Windows users
146
- -- use_absolute_path = true,
147
- -- },
148
- -- },
149
- -- },
118
+ mappings = {
119
+ suggestion = {
120
+ accept = " <Tab>" ,
121
+ next = " <M-]>" ,
122
+ prev = " <M-[>" ,
123
+ dismiss = " <C-]>" ,
124
+ },
150
125
},
151
126
},
152
- copilot_lua ,
153
- copilot_chat ,
154
- },
155
- fittencode = {
156
- {
157
- " luozhiya/fittencode.nvim" ,
158
- config = function ()
159
- require (" fittencode" ).setup ()
160
- end ,
127
+ -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
128
+ build = " make" ,
129
+ -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
130
+ dependencies = {
131
+ " stevearc/dressing.nvim" ,
132
+ " nvim-lua/plenary.nvim" ,
133
+ " MunifTanjim/nui.nvim" ,
134
+ --- The below dependencies are optional,
135
+ " nvim-tree/nvim-web-devicons" , -- or echasnovski/mini.icons
136
+ -- {
137
+ -- -- support for image pasting
138
+ -- "HakonHarnes/img-clip.nvim",
139
+ -- event = "VeryLazy",
140
+ -- opts = {
141
+ -- -- recommended settings
142
+ -- default = {
143
+ -- embed_image_as_base64 = false,
144
+ -- prompt_for_file_name = false,
145
+ -- drag_and_drop = {
146
+ -- insert_mode = true,
147
+ -- },
148
+ -- -- required for Windows users
149
+ -- use_absolute_path = true,
150
+ -- },
151
+ -- },
152
+ -- },
161
153
},
162
154
},
163
- tabnine = { { " codota/tabnine-nvim" , build = " ./dl_binaries.sh" } },
164
- codeium = { { " Exafunction/codeium.vim" , event = " BufEnter" } },
155
+ {
156
+ " luozhiya/fittencode.nvim" ,
157
+ cond = vim .g .ai_suggestion == " fittencode" ,
158
+ config = function ()
159
+ require (" fittencode" ).setup ()
160
+ end ,
161
+ },
162
+ {
163
+ " codota/tabnine-nvim" ,
164
+ cond = vim .g .ai_suggestion == " tabnine-nvim" ,
165
+ build = " ./dl_binaries.sh" ,
166
+ },
167
+ {
168
+ " Exafunction/codeium.vim" ,
169
+ cond = vim .g .ai_suggestion == " codeium.vim" ,
170
+ event = " BufEnter" ,
171
+ },
165
172
}
166
-
167
- return plugins [vim .g .ai_complete ]
0 commit comments