chore(nvim): switch to copilot.lua

main
sudo pacman -Syu 2023-07-05 16:57:39 +07:00
parent 51b94d9216
commit 421bcda149
1 changed files with 36 additions and 19 deletions

View File

@ -52,23 +52,6 @@ vim.g.neoformat_basic_format_trim = 1
vim.g.neoformat_enabled_go = { "gofumpt" } vim.g.neoformat_enabled_go = { "gofumpt" }
vim.g.shfmt_opt = "-ci" vim.g.shfmt_opt = "-ci"
-- Use plugin copilot
vim.g.copilot_filetypes = {
["*"] = false,
c = true,
cpp = true,
go = true,
java = true,
json = true,
lua = true,
make = true,
markdown = true,
proto = true,
python = true,
toml = true,
yaml = true,
}
-- https://github.com/folke/lazy.nvim -- https://github.com/folke/lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then if not vim.loop.fs_stat(lazypath) then
@ -209,6 +192,15 @@ require("lazy").setup({
{ name = "buffer" }, { name = "buffer" },
}), }),
}) })
-- Support copilot
cmp.event:on("menu_opened", function()
vim.b.copilot_suggestion_hidden = true
end)
cmp.event:on("menu_closed", function()
vim.b.copilot_suggestion_hidden = false
end)
end, end,
}, },
@ -393,6 +385,31 @@ require("lazy").setup({
end, end,
}, },
-- https://github.com/github/copilot.vim -- https://github.com/zbirenbaum/copilot.lua
"github/copilot.vim", {
"zbirenbaum/copilot.lua",
event = "InsertEnter",
config = function()
require("copilot").setup({
suggestion = {
auto_trigger = true,
},
filetypes = {
["."] = false,
c = true,
cpp = true,
go = true,
java = true,
json = true,
lua = true,
make = true,
markdown = true,
proto = true,
python = true,
toml = true,
yaml = true,
},
})
end,
},
}) })