Files
lua-nvim/lua/cargdev/plugins/copilot.lua
Carlos Gutierrez 0066ac1441 Fix keymap conflicts and add improvements
- Fix duplicate git conflict keymaps (centralized in gitconflict.lua)
- Fix duplicate Copilot keymaps (centralized in copilot.lua)
- Change insert mode escape from 'jk' to 'jj' to avoid typing conflicts
- Add word counter to statusline (lualine)
- Disable Copilot by default for .tex files
- Remove textwidth limits for visual wrapping based on window width
- Add comprehensive improvements documentation (IMPROVEMENTS.md)
- Update README with links to documentation
2026-01-10 16:31:17 -05:00

86 lines
2.2 KiB
Lua

return {
{
"zbirenbaum/copilot.lua",
cmd = "Copilot",
event = "InsertEnter",
config = function()
require("copilot").setup({
panel = {
enabled = true,
auto_refresh = false,
layout = {
position = "bottom", -- | top | left | right
ratio = 0.4,
},
},
suggestion = {
enabled = true,
auto_trigger = true, -- Enable auto-trigger suggestions as you type
debounce = 75,
},
filetypes = {
markdown = true,
help = true,
gitcommit = true,
gitrebase = true,
hgcommit = true,
svn = true,
cvs = true,
tex = false, -- Disable Copilot for LaTeX files by default
["."] = true,
},
copilot_node_command = "node", -- Node.js version must be > 16.x
server_opts_overrides = {},
})
-- Disable Copilot when opening .tex files
vim.api.nvim_create_autocmd({ "FileType", "BufEnter" }, {
pattern = "tex",
callback = function()
-- Safely dismiss any active suggestions
local ok, suggestion = pcall(require, "copilot.suggestion")
if ok and suggestion and suggestion.is_visible() then
suggestion.dismiss()
end
-- Disable Copilot for this buffer
vim.cmd("Copilot disable")
end,
desc = "Disable Copilot for LaTeX files",
})
end,
},
{
"zbirenbaum/copilot-cmp",
dependencies = { "zbirenbaum/copilot.lua" },
config = function()
require("copilot_cmp").setup()
end,
},
{
"olimorris/codecompanion.nvim",
dependencies = {
"zbirenbaum/copilot.lua",
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
},
cmd = { "CodeCompanion" },
config = function()
require("codecompanion").setup({
-- Use GitHub Copilot as the provider
providers = {
copilot = {
enabled = true,
},
},
-- Configure the UI
ui = {
window = {
width = 0.8,
height = 0.8,
},
},
})
end,
},
}