From c5c2ccee7b40077cc443d678494202f33ed49160 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 29 Mar 2023 15:57:28 +0700 Subject: [PATCH 1/2] feat: add module copilot use official plugin --- lua/user/modules/features/copilot/init.lua | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 lua/user/modules/features/copilot/init.lua diff --git a/lua/user/modules/features/copilot/init.lua b/lua/user/modules/features/copilot/init.lua new file mode 100644 index 00000000..9670a74d --- /dev/null +++ b/lua/user/modules/features/copilot/init.lua @@ -0,0 +1,38 @@ +local M = {} + +M.settings = {} + +M.packages = { + + ["copilot.vim"] = { + "github/copilot.vim", + }, +} +-- local function getMappings1() +-- return key_mappings; +-- end + +M.configs = { + -- ["copilot-cmp"] = function() + -- require("copilot_cmp").setup() + -- end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds = { +-- { +-- "go", +-- [[Octo actions]], +-- name = "Octo menu", +-- mode = "nv", +-- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps + +return M From 485c43a5b2a56ad0e416e2081cae38ec7ee16e99 Mon Sep 17 00:00:00 2001 From: Tuan Bui Date: Wed, 29 Mar 2023 15:58:17 +0700 Subject: [PATCH 2/2] feat: add module copilot using copilot.lua --- config.lua | 9 +++ lua/user/modules/features/copilot2/init.lua | 68 +++++++++++++++++++++ modules.lua | 2 + 3 files changed, 79 insertions(+) create mode 100644 lua/user/modules/features/copilot2/init.lua diff --git a/config.lua b/config.lua index c989cf21..d9cb5f67 100644 --- a/config.lua +++ b/config.lua @@ -47,8 +47,17 @@ end if doom.features.lsp ~= nil then doom.features.lsp.requires_modules = { "features.auto_install" } + doom.features.lsp.settings.completion.sources = { + { name = "copilot" }, + { name = "nvim_lua" }, + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "path" }, + { name = "buffer" }, + } end + -- not hide file with any prifix doom.features.explorer.settings.filters.custom={} -- doom.features. diff --git a/lua/user/modules/features/copilot2/init.lua b/lua/user/modules/features/copilot2/init.lua new file mode 100644 index 00000000..6e814558 --- /dev/null +++ b/lua/user/modules/features/copilot2/init.lua @@ -0,0 +1,68 @@ +local M = {} + +M.settings = {} + +M.packages = { + + ["copilot.lua"] = { + "zbirenbaum/copilot.lua", + -- cmd = "Copilot", + -- event = "InsertEnter", + }, + ["copilot-cmp"] = { + "zbirenbaum/copilot-cmp", + after = { "copilot.lua" }, + }, + -- ["vimade"] = { + -- "TaDaa/vimade", + -- }, +} +-- local function getMappings1() +-- return key_mappings; +-- end + +M.configs = { + ["copilot-cmp"] = function() + require("copilot_cmp").setup() + end, + ["copilot.lua"] = function() + -- require("copilot").setup({ + -- suggestion = { + -- auto_trigger = true, + -- keymap = { + -- accept = "", + -- }, + -- }, + -- }) + vim.defer_fn(function() + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + end, 100) + + -- require("copilot").setup({ + -- suggestion = { enabled = false }, + -- panel = { enabled = false }, + -- }) + end, +} + +M.autocmds = {} + +M.cmds = {} +-- M.requires_modules = { "features.auto_install" } +-- M.binds = { +-- { +-- "go", +-- [[Octo actions]], +-- name = "Octo menu", +-- mode = "nv", +-- }, +-- } + +-- Notes: +-- code for load module located at doom.core.module.load_modules +-- code for binding: ddom.services.keymaps.applyKeymaps + +return M diff --git a/modules.lua b/modules.lua index 288d9537..aaf8ccde 100644 --- a/modules.lua +++ b/modules.lua @@ -65,6 +65,8 @@ return { "entertainments", "scratch", "github", + -- "copilot", -- Copilot using standard Copilot from github/tpope + "copilot2", -- Copilot using Copilot lua plugin from zbirenbaum -- -- "charcounter", -- custom module test },