-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcopilot.lua
More file actions
68 lines (63 loc) · 2.25 KB
/
Copy pathcopilot.lua
File metadata and controls
68 lines (63 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
-- =============================================================================
-- GITHUB COPILOT SETTINGS
-- =============================================================================
-- Integrates GitHub Copilot.
-- - Disabled by default. Can be enabled on-demand via `:Copilot enable`.
-- - Toggle using the keymap `<leader>cp` with desktop status notifications.
-- - Sourced into nvim-cmp to provide completion suggestions alongside LSP.
-- =============================================================================
return {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({
panel = {
enabled = false, -- Disabled: we use copilot-cmp and CopilotChat instead
},
suggestion = {
enabled = false, -- Disabled: we show Copilot items in the autocomplete list
},
filetypes = {
yaml = false,
markdown = false,
help = false,
gitcommit = false,
gitrebase = false,
hgcommit = false,
svn = false,
cvs = false,
["."] = false,
},
copilot_node_command = "node", -- Node.js version must be >= 18.x
})
-- --- DISABLED BY DEFAULT ---
-- To enable GitHub Copilot permanently on startup, delete or comment out
-- the line below:
vim.cmd("Copilot disable")
-- State tracker for toggling Copilot
local copilot_active = false
local function toggle_copilot()
if copilot_active then
vim.cmd("Copilot disable")
copilot_active = false
vim.notify("GitHub Copilot Disabled", vim.log.levels.WARN, { title = "mu-vim" })
else
vim.cmd("Copilot enable")
copilot_active = true
vim.notify("GitHub Copilot Enabled", vim.log.levels.INFO, { title = "mu-vim" })
end
end
-- Toggle Copilot keybind (with desc for Which-Key discovery)
vim.keymap.set("n", "<leader>cp", toggle_copilot, { desc = "Toggle GitHub Copilot" })
end,
},
{
"zbirenbaum/copilot-cmp",
dependencies = { "zbirenbaum/copilot.lua" },
config = function()
require("copilot_cmp").setup()
end,
},
}