chore: remove local/unused plugins and refactor core configs
- Remove locally-developed or rarely-used plugin packages (codetyper, curls, edgy, flash) to reduce maintenance surface, external deps, and startup cost; these were local/optional and caused complexity. - Clean up stale/keymap docs and small duplicate or experimental files (keymaps/README.md, sudoku keymaps). - Apply targeted refactors to core modules for readability, robustness, and to align Java/DAP/Copilot integrations with local environment. - Removed plugin modules: - lua/cargdev/plugins/codetyper.lua (deleted) - lua/cargdev/plugins/curls.lua (deleted) - lua/cargdev/plugins/edgy.lua (deleted) - lua/cargdev/plugins/flash.lua (deleted) - Added .codetyper to .gitignore - Java / JDTLS: - ftplugin/java.lua: pin jdtls java executable to JDK 25, switch to mac_arm config, enable LSP formatter and declare multiple runtimes (JavaSE-17, JavaSE-25). - Notifications & startup UX: - lua/cargdev/core/function/notification_manager.lua: large refactor — use local aliases (api, cmd, loop, opt), improved docs, dashboard-aware handling, nvim-notify fallback, safer tracking and cleanup of notifications. - Utilities & monitors: - lua/cargdev/core/function/performance_monitor.lua: use local references, better notify usage and docs. - lua/cargdev/core/function/project_commands.lua: add docs, use local api/fn/notify, clearer RunProject/DebugProject commands. - Terminal helper: - lua/cargdev/core/function/openTerminal.lua: add module docs and small refactor to use local cmd/api aliases and expose keymap. - Keymaps & docs: - Removed stale keymaps README (lua/cargdev/core/keymaps/README.md). - Reworked many keymap files: docstrings, renamed/moved mappings to avoid conflicts, moved DAP mappings into dap plugin config, removed/disabled experimental mappings (see files under lua/cargdev/core/keymaps/*). - Adjusted quick keybindings and prefixes to reduce overlaps. - Plugins & integrations: - lua/cargdev/plugins/formatting.lua: disabled google-java-format fallback for java (prefer JDTLS). - lua/cargdev/plugins/dap.lua: added additional DAP configs (Bun launch, attach helper), moved/registered dap keymaps here. - lua/cargdev/plugins/copilot.lua: reorganized Copilot/Copilot-cmp/CopilotChat config and added copilot source to nvim-cmp. - lua/cargdev/plugins/nvim-cmp.lua: added copilot source and small formatting tweak.
This commit is contained in:
@@ -1,27 +1,33 @@
|
||||
-- ============================================================================
|
||||
-- COPILOT: GitHub AI code completion and chat
|
||||
-- ============================================================================
|
||||
-- AI-powered code suggestions that appear as ghost text while typing.
|
||||
-- Includes copilot-cmp for completion menu integration and codecompanion
|
||||
-- for AI chat/refactoring. Disabled for LaTeX files. Accept with <C-l>.
|
||||
-- AI-powered code suggestions (ghost text + cmp menu) and chat.
|
||||
-- Autocomplete: <C-l> accept ghost text, also shows in cmp menu.
|
||||
-- Chat: <leader>cc toggle, <leader>cq quick chat, <leader>ce explain.
|
||||
--
|
||||
-- MODEL SELECTION:
|
||||
-- Chat: :CopilotChatModels (pick from gpt-4o, claude-sonnet-4, o3-mini, etc.)
|
||||
-- Autocomplete: controlled server-side by GitHub, not user-selectable.
|
||||
-- ============================================================================
|
||||
return {
|
||||
-- Copilot core: ghost text suggestions + LSP backend
|
||||
{
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("copilot").setup({
|
||||
copilot_model = "gpt-41-copilot",
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = false,
|
||||
layout = {
|
||||
position = "bottom", -- | top | left | right
|
||||
position = "bottom",
|
||||
ratio = 0.4,
|
||||
},
|
||||
},
|
||||
suggestion = {
|
||||
enabled = true, -- Codetyper will use copilot when available
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
debounce = 75,
|
||||
keymap = {
|
||||
@@ -39,10 +45,10 @@ return {
|
||||
hgcommit = true,
|
||||
svn = true,
|
||||
cvs = true,
|
||||
tex = false, -- Disable Copilot for LaTeX files by default
|
||||
tex = false,
|
||||
["."] = true,
|
||||
},
|
||||
copilot_node_command = "node", -- Node.js version must be > 16.x
|
||||
copilot_node_command = "node",
|
||||
server_opts_overrides = {},
|
||||
})
|
||||
|
||||
@@ -50,18 +56,18 @@ return {
|
||||
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,
|
||||
},
|
||||
|
||||
-- Copilot CMP: adds Copilot as a completion source in nvim-cmp menu
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
dependencies = { "zbirenbaum/copilot.lua" },
|
||||
@@ -69,28 +75,58 @@ return {
|
||||
require("copilot_cmp").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- CopilotChat: full chat interface with model selection
|
||||
{
|
||||
"olimorris/codecompanion.nvim",
|
||||
"CopilotC-Nvim/CopilotChat.nvim",
|
||||
dependencies = {
|
||||
"zbirenbaum/copilot.lua",
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope.nvim",
|
||||
},
|
||||
cmd = { "CodeCompanion" },
|
||||
build = "make tiktoken",
|
||||
cmd = {
|
||||
"CopilotChat",
|
||||
"CopilotChatToggle",
|
||||
"CopilotChatModels",
|
||||
"CopilotChatExplain",
|
||||
"CopilotChatReview",
|
||||
"CopilotChatFix",
|
||||
"CopilotChatOptimize",
|
||||
"CopilotChatDocs",
|
||||
"CopilotChatTests",
|
||||
"CopilotChatCommit",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>cc", "<cmd>CopilotChatToggle<cr>", desc = "CopilotChat: Toggle chat window" },
|
||||
{ "<leader>cq", function()
|
||||
local input = vim.fn.input("Quick Chat: ")
|
||||
if input ~= "" then
|
||||
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
|
||||
end
|
||||
end, desc = "CopilotChat: Quick chat (whole buffer)" },
|
||||
{ "<leader>ce", "<cmd>CopilotChatExplain<cr>", mode = { "n", "v" }, desc = "CopilotChat: Explain code" },
|
||||
{ "<leader>cr", "<cmd>CopilotChatReview<cr>", mode = { "n", "v" }, desc = "CopilotChat: Review code" },
|
||||
{ "<leader>cf", "<cmd>CopilotChatFix<cr>", mode = { "n", "v" }, desc = "CopilotChat: Fix code" },
|
||||
{ "<leader>co", "<cmd>CopilotChatOptimize<cr>", mode = { "n", "v" }, desc = "CopilotChat: Optimize code" },
|
||||
{ "<leader>cd", "<cmd>CopilotChatDocs<cr>", mode = { "n", "v" }, desc = "CopilotChat: Generate docs" },
|
||||
{ "<leader>ct", "<cmd>CopilotChatTests<cr>", mode = { "n", "v" }, desc = "CopilotChat: Generate tests" },
|
||||
{ "<leader>cm", "<cmd>CopilotChatModels<cr>", desc = "CopilotChat: Select model" },
|
||||
},
|
||||
config = function()
|
||||
require("codecompanion").setup({
|
||||
-- Use GitHub Copilot as the provider
|
||||
providers = {
|
||||
copilot = {
|
||||
enabled = true,
|
||||
},
|
||||
require("CopilotChat").setup({
|
||||
-- Default model (change with :CopilotChatModels at runtime)
|
||||
-- Options include: gpt-4o, claude-sonnet-4, o3-mini, gemini-2.0-flash, etc.
|
||||
model = "claude-sonnet-4",
|
||||
window = {
|
||||
layout = "vertical",
|
||||
width = 0.35,
|
||||
border = "rounded",
|
||||
},
|
||||
-- Configure the UI
|
||||
ui = {
|
||||
window = {
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
},
|
||||
mappings = {
|
||||
complete = { insert = "<Tab>" },
|
||||
close = { normal = "q", insert = "<C-c>" },
|
||||
reset = { normal = "<C-x>", insert = "<C-x>" },
|
||||
submit_prompt = { normal = "<CR>", insert = "<C-s>" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user