1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-01 20:59:26 +00:00

[neovim] Add copilot

This commit is contained in:
2024-02-12 20:46:40 +01:00
parent 64cf03dcac
commit d1c002183f
10 changed files with 72 additions and 24 deletions

View File

@ -122,7 +122,7 @@ keymap(
keymap(
"n",
"<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" })
)
keymap(
@ -132,7 +132,7 @@ keymap(
vim.tbl_extend("force", opts, { desc = "Peek the definition of the directive under the cursor" })
)
keymap(
{"n", "v"},
{ "n", "v" },
"<leader>lf",
"<cmd>lua vim.lsp.buf.format{ async=true }<cr>",
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" })
)
-- 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
keymap("v", "p", "P", vim.tbl_extend("force", opts, { desc = "Paste" }))

View File

@ -168,10 +168,10 @@ require("lazy").setup({
"hrsh7th/cmp-nvim-lsp",
},
},
{
"Exafunction/codeium.nvim",
event = "BufEnter",
},
-- {
-- "Exafunction/codeium.nvim",
-- event = "BufEnter",
-- },
-- Snippets
{ "L3MON4D3/LuaSnip", version = "v2.*", event = "InsertEnter" },
@ -283,6 +283,24 @@ require("lazy").setup({
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
{
"kevinhwang91/nvim-ufo",

View File

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

View File

@ -103,7 +103,7 @@ cmp.setup({
nvim_lsp = "[lsp]",
luasnip = "[snip]",
buffer = "[local]",
codeium = "[AI]",
copilot = "[AI]",
path = "",
emoji = "",
})[entry.source.name]
@ -115,7 +115,7 @@ cmp.setup({
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "codeium" },
{ name = "copilot" },
},
confirm_opts = {
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.codeium")
require("plugins.copilot")
require("plugins.telescope")
require("plugins.starter")
require("plugins.treesitter")

View File

@ -98,6 +98,7 @@ require("lualine").setup({
return true
end,
},
"copilot",
lsp_progress,
{
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!')
end, {})
local neotest = require("neotest")
neotest.setup({
@ -30,11 +29,10 @@ neotest.setup({
},
})
vim.api.nvim_create_user_command("RunTest", function()
neotest.run.run()
neotest.run.run()
end, {})
vim.api.nvim_create_user_command("RunTestFile", function()
neotest.run.run(vim.fn.expand('%'))
neotest.run.run(vim.fn.expand("%"))
end, {})