1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2024-12-22 11:38:00 +00:00

[neovim] Add copilot

This commit is contained in:
Daniel Carrillo 2024-02-12 20:46:40 +01:00
parent 64cf03dcac
commit d1c002183f
Signed by: dcarrillo
GPG Key ID: E4CD5C09DAED6E16
10 changed files with 72 additions and 24 deletions

View File

@ -1,6 +1,5 @@
{ {
"Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" }, "Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
"DAPInstall.nvim": { "branch": "main", "commit": "8798b4c36d33723e7bba6ed6e2c202f84bb300de" },
"FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" },
"LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" }, "LuaSnip": { "branch": "master", "commit": "8ae1dedd988eb56441b7858bd1e8554dfadaa46d" },
"auto-save.nvim": { "branch": "main", "commit": "4b59610e1318f8a89501cee9d47a0e8650f0a4d5" }, "auto-save.nvim": { "branch": "main", "commit": "4b59610e1318f8a89501cee9d47a0e8650f0a4d5" },
@ -10,19 +9,19 @@
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"codeium.nvim": { "branch": "main", "commit": "f871000e91faa9ed334da2bfa4eadbf54d0e1047" }, "codeium.nvim": { "branch": "main", "commit": "ad6705cacce51df32c9fd72b66f38cb242a95485" },
"diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" }, "diffview.nvim": { "branch": "main", "commit": "3dc498c9777fe79156f3d32dddd483b8b3dbd95f" },
"friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" }, "friendly-snippets": { "branch": "main", "commit": "b8fae73a479ae0a1c54f5c98fa687ae8a0addc53" },
"fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" }, "fzy-lua-native": { "branch": "master", "commit": "820f745b7c442176bcc243e8f38ef4b985febfaf" },
"git-blame.nvim": { "branch": "master", "commit": "196602b570b1d754b7b8f9a9f75fa7bd88f12ef8" }, "git-blame.nvim": { "branch": "master", "commit": "196602b570b1d754b7b8f9a9f75fa7bd88f12ef8" },
"github-nvim-theme": { "branch": "main", "commit": "d92e1143e5aaa0d7df28a26dd8ee2102df2cadd8" }, "github-nvim-theme": { "branch": "main", "commit": "d92e1143e5aaa0d7df28a26dd8ee2102df2cadd8" },
"gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" }, "gitsigns.nvim": { "branch": "main", "commit": "6ef8c54fb526bf3a0bc4efb0b2fe8e6d9a7daed2" },
"go.nvim": { "branch": "master", "commit": "096f65692034022c963b55f493961a8a1d861ba4" }, "go.nvim": { "branch": "master", "commit": "d748e79011437d5b080006b896b3c296656641d7" },
"guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" }, "guihua.lua": { "branch": "master", "commit": "9fb6795474918b492d9ab01b1ebaf85e8bf6fe0b" },
"indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" }, "indent-blankline.nvim": { "branch": "master", "commit": "12e92044d313c54c438bd786d11684c88f6f78cd" },
"karen-yank.nvim": { "branch": "main", "commit": "817f50c9464ce557c8f7f8f4d4c8d2f7b81fc40c" }, "karen-yank.nvim": { "branch": "main", "commit": "817f50c9464ce557c8f7f8f4d4c8d2f7b81fc40c" },
"lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" },
"leap.nvim": { "branch": "main", "commit": "e285f3c9a3fb11367f859faf553d28f332da0a2c" }, "leap.nvim": { "branch": "main", "commit": "46e9b1a1d7438ac72794b0857b20cad4390b827c" },
"lspsaga.nvim": { "branch": "main", "commit": "2198c07124bef27ef81335be511c8abfd75db933" }, "lspsaga.nvim": { "branch": "main", "commit": "2198c07124bef27ef81335be511c8abfd75db933" },
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" }, "lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
"lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" }, "lualine.nvim": { "branch": "master", "commit": "7d131a8d3ba5016229e8a1d08bf8782acea98852" },
@ -33,7 +32,7 @@
"mini.starter": { "branch": "main", "commit": "0ee58ac8975a929e90c8b104987fabfd13015e25" }, "mini.starter": { "branch": "main", "commit": "0ee58ac8975a929e90c8b104987fabfd13015e25" },
"neo-tree.nvim": { "branch": "v2.x", "commit": "e578fe7a5832421b0d2c5b3c0a7a1e40e0f6a47a" }, "neo-tree.nvim": { "branch": "v2.x", "commit": "e578fe7a5832421b0d2c5b3c0a7a1e40e0f6a47a" },
"neotest": { "branch": "master", "commit": "89a5b1fc22ee5d459262955fe564c3d14e35fd67" }, "neotest": { "branch": "master", "commit": "89a5b1fc22ee5d459262955fe564c3d14e35fd67" },
"neotest-go": { "branch": "main", "commit": "22513619bcb156939c22ea7cd1a99f754fcb1fde" }, "neotest-go": { "branch": "main", "commit": "17579611af5d47bea5ff4d77e6493a6d647d3a15" },
"neovim-project": { "branch": "main", "commit": "e7868b38f402be94e859d479002df1418bc1e954" }, "neovim-project": { "branch": "main", "commit": "e7868b38f402be94e859d479002df1418bc1e954" },
"neovim-session-manager": { "branch": "master", "commit": "07bb62583769abd9d32f88f428ea58248730ac7a" }, "neovim-session-manager": { "branch": "master", "commit": "07bb62583769abd9d32f88f428ea58248730ac7a" },
"noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" },
@ -42,22 +41,24 @@
"nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" }, "nvim-autopairs": { "branch": "master", "commit": "096d0baecc34f6c5d8a6dd25851e9d5ad338209b" },
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" }, "nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
"nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" }, "nvim-dap": { "branch": "master", "commit": "9d81c11fd185a131f81841e64941859305f6c42d" },
"nvim-dap-python": { "branch": "master", "commit": "f5b6f3a90aae0284b61fb3565e575267c19a16e6" },
"nvim-dap-ui": { "branch": "master", "commit": "0b4816e5ad5f3219e8e3ec9cce07f61b770c1974" }, "nvim-dap-ui": { "branch": "master", "commit": "0b4816e5ad5f3219e8e3ec9cce07f61b770c1974" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" }, "nvim-dap-virtual-text": { "branch": "master", "commit": "d4542ac257d3c7ee4131350db6179ae6340ce40b" },
"nvim-lspconfig": { "branch": "master", "commit": "d12140c5687a1186b95b3f42dbc6cc769df0cf0d" }, "nvim-lspconfig": { "branch": "master", "commit": "41f40dc4b86f3e166cf08115f621001972565a20" },
"nvim-treesitter": { "branch": "master", "commit": "4fbf150a1621d52f17b099506e1a32f107079210" }, "nvim-treesitter": { "branch": "master", "commit": "9860fceb73eb85a9ad424513fe163e6506dfb1fd" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "7ab799a9792f7cf3883cf28c6a00ad431f3d382a" },
"nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" }, "nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" },
"nvim-web-devicons": { "branch": "master", "commit": "aaec87dbdaa776bfa0a13c8694bec9bcb7454719" }, "nvim-web-devicons": { "branch": "master", "commit": "7f30f2da3c3641841ceb0e2c150281f624445e8f" },
"plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" },
"promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" }, "promise-async": { "branch": "main", "commit": "94f6f03c6c1e2aab551aacdf0c1e597a7269abb6" },
"statuscol.nvim": { "branch": "main", "commit": "3b629754420919575a9e5758027d6e1831dbf2aa" }, "statuscol.nvim": { "branch": "main", "commit": "3b629754420919575a9e5758027d6e1831dbf2aa" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "7b5c5f56a21e82fdcfe5b250278b8dfc4b1cbab4" }, "telescope.nvim": { "branch": "master", "commit": "0f865f17af4f9bc1587a0132414cdfd32d91852e" },
"tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" }, "tokyonight.nvim": { "branch": "main", "commit": "610179f7f12db3d08540b6cc61434db2eaecbcff" },
"trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" }, "trouble.nvim": { "branch": "main", "commit": "f1168feada93c0154ede4d1fe9183bf69bac54ea" },
"typescript-tools.nvim": { "branch": "master", "commit": "c43d9580c3ff5999a1eabca849f807ab33787ea7" }, "typescript-tools.nvim": { "branch": "master", "commit": "c43d9580c3ff5999a1eabca849f807ab33787ea7" },
"venv-selector.nvim": { "branch": "main", "commit": "fcb30164f2c4f8a34a305ead3247954a1fd8634f" },
"vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" }, "vim-bbye": { "branch": "master", "commit": "25ef93ac5a87526111f43e5110675032dbcacf56" },
"vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" }, "vim-illuminate": { "branch": "master", "commit": "305bf07b919ac526deb5193280379e2f8b599926" },
"vim-kitty-navigator": { "branch": "master", "commit": "20abf8613aa228a5def1ae02cd9da0f2d210352a" }, "vim-kitty-navigator": { "branch": "master", "commit": "20abf8613aa228a5def1ae02cd9da0f2d210352a" },

View File

@ -122,7 +122,7 @@ keymap(
keymap( keymap(
"n", "n",
"<leader>lr", "<leader>lr",
"<cmd>Lspsaga rename<cr>", "<cmd>Lspsaga rename mode=n<cr>",
vim.tbl_extend("force", opts, { desc = "Open a dialog to rename a code element" }) vim.tbl_extend("force", opts, { desc = "Open a dialog to rename a code element" })
) )
keymap( keymap(
@ -132,7 +132,7 @@ keymap(
vim.tbl_extend("force", opts, { desc = "Peek the definition of the directive under the cursor" }) vim.tbl_extend("force", opts, { desc = "Peek the definition of the directive under the cursor" })
) )
keymap( keymap(
{"n", "v"}, { "n", "v" },
"<leader>lf", "<leader>lf",
"<cmd>lua vim.lsp.buf.format{ async=true }<cr>", "<cmd>lua vim.lsp.buf.format{ async=true }<cr>",
vim.tbl_extend("force", opts, { desc = "Format the current buffer or selection" }) vim.tbl_extend("force", opts, { desc = "Format the current buffer or selection" })
@ -152,6 +152,20 @@ keymap(
vim.tbl_extend("force", opts, { desc = "Run tests on the current file" }) vim.tbl_extend("force", opts, { desc = "Run tests on the current file" })
) )
-- Copilot
keymap(
"n",
"<leader>coe",
"<cmd>CopilotChatExplain<cr>",
vim.tbl_extend("force", opts, { desc = "CopilotChat - Explain code" })
)
keymap(
"n",
"<leader>cot",
"<cmd>CopilotChatTests<cr>",
vim.tbl_extend("force", opts, { desc = "CopilotChat - Generate tests" })
)
-- Better paste -- Better paste
keymap("v", "p", "P", vim.tbl_extend("force", opts, { desc = "Paste" })) keymap("v", "p", "P", vim.tbl_extend("force", opts, { desc = "Paste" }))

View File

@ -168,10 +168,10 @@ require("lazy").setup({
"hrsh7th/cmp-nvim-lsp", "hrsh7th/cmp-nvim-lsp",
}, },
}, },
{ -- {
"Exafunction/codeium.nvim", -- "Exafunction/codeium.nvim",
event = "BufEnter", -- event = "BufEnter",
}, -- },
-- Snippets -- Snippets
{ "L3MON4D3/LuaSnip", version = "v2.*", event = "InsertEnter" }, { "L3MON4D3/LuaSnip", version = "v2.*", event = "InsertEnter" },
@ -283,6 +283,24 @@ require("lazy").setup({
ft = { "markdown" }, ft = { "markdown" },
}, },
-- Copilot
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
},
{ "zbirenbaum/copilot-cmp" },
{ "AndreM222/copilot-lualine" },
{
"copilotc-nvim/copilotchat.nvim",
opts = {
show_help = "yes",
debug = false,
disable_extra_info = "yes",
},
event = "VeryLazy",
},
-- Folding -- Folding
{ {
"kevinhwang91/nvim-ufo", "kevinhwang91/nvim-ufo",

View File

@ -35,7 +35,7 @@ bufferline.setup({
text = "" .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. "" text = "" .. string.gsub(vim.loop.cwd(), "^" .. os.getenv("HOME"), "~") .. ""
end end
return { { text = text, fg = "#636E7B" } } return { { text = text, fg = "#adbac7" } }
end, end,
}, },
}, },

View File

@ -103,7 +103,7 @@ cmp.setup({
nvim_lsp = "[lsp]", nvim_lsp = "[lsp]",
luasnip = "[snip]", luasnip = "[snip]",
buffer = "[local]", buffer = "[local]",
codeium = "[AI]", copilot = "[AI]",
path = "", path = "",
emoji = "", emoji = "",
})[entry.source.name] })[entry.source.name]
@ -115,7 +115,7 @@ cmp.setup({
{ name = "luasnip" }, { name = "luasnip" },
{ name = "buffer" }, { name = "buffer" },
{ name = "path" }, { name = "path" },
{ name = "codeium" }, { name = "copilot" },
}, },
confirm_opts = { confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace, behavior = cmp.ConfirmBehavior.Replace,

View File

@ -1 +0,0 @@
require("codeium").setup({})

View File

@ -0,0 +1,17 @@
require("copilot").setup({
suggestion = { enabled = false },
panel = { enabled = false },
filetypes = {
javascript = true,
typescript = true,
go = true,
lua = true,
python = true,
sh = true,
yaml = true,
json = true,
["*"] = false,
},
})
require("copilot_cmp").setup()

View File

@ -1,5 +1,5 @@
require("plugins.cmp") require("plugins.cmp")
require("plugins.codeium") require("plugins.copilot")
require("plugins.telescope") require("plugins.telescope")
require("plugins.starter") require("plugins.starter")
require("plugins.treesitter") require("plugins.treesitter")

View File

@ -98,6 +98,7 @@ require("lualine").setup({
return true return true
end, end,
}, },
"copilot",
lsp_progress, lsp_progress,
{ {
require("noice").api.status.search.get, require("noice").api.status.search.get,

View File

@ -15,7 +15,6 @@ vim.api.nvim_create_user_command("CopyDirectoryPath", function()
vim.notify('Copied "' .. path .. '" to the clipboard!') vim.notify('Copied "' .. path .. '" to the clipboard!')
end, {}) end, {})
local neotest = require("neotest") local neotest = require("neotest")
neotest.setup({ neotest.setup({
@ -30,11 +29,10 @@ neotest.setup({
}, },
}) })
vim.api.nvim_create_user_command("RunTest", function() vim.api.nvim_create_user_command("RunTest", function()
neotest.run.run() neotest.run.run()
end, {}) end, {})
vim.api.nvim_create_user_command("RunTestFile", function() vim.api.nvim_create_user_command("RunTestFile", function()
neotest.run.run(vim.fn.expand('%')) neotest.run.run(vim.fn.expand("%"))
end, {}) end, {})