diff --git a/lua/cargdev/plugins/codetyper.lua b/lua/cargdev/plugins/codetyper.lua new file mode 100644 index 0000000..c7c27d7 --- /dev/null +++ b/lua/cargdev/plugins/codetyper.lua @@ -0,0 +1,125 @@ +-- ============================================================================ +-- CODETYPER.NVIM: AI-powered coding assistant plugin +-- ============================================================================ +-- A local development plugin that provides AI-assisted coding capabilities +-- using various LLM providers (Ollama, Claude, OpenAI, Gemini, Copilot). +-- Features include: inline code transformation with /@ @/ tags, Ask panel +-- for interactive queries, Agent panel for autonomous coding tasks, +-- Tree-sitter integration for scope detection, and diff review. +-- +-- Key keymaps: +-- co - Open Coder view ca - Open Ask panel +-- ct - Toggle Coder view cg - Open Agent panel +-- cp - Process prompt cd - Open Diff Review +-- ctt - Transform tag at cursor (also works in visual mode) +-- ============================================================================ + +-- Get local config (loaded in core/init.lua) +local local_cfg = vim.g.cargdev_local or {} + +-- Skip plugin if local config is missing required values +if not local_cfg.CODE_TYPER_DIR then + return {} +end + +return { + -- Codetyper.nvim - AI-powered coding partner + -- Local development version + dir = local_cfg.CODE_TYPER_DIR, + name = "codetyper.nvim", + lazy = false, -- Load on startup to create .coder folder + priority = 100, -- Load early + dependencies = { + "nvim-lua/plenary.nvim", -- Required: async utilities + -- "nvim-treesitter/nvim-treesitter", -- Required: scope detection via Tree-sitter + -- "nvim-treesitter/nvim-treesitter-textobjects", -- Optional: better text object support + "MunifTanjim/nui.nvim", -- Optional: UI components + }, + event = { + "BufReadPre *.coder.*", + "BufNewFile *.coder.*", + }, + cmd = { + "Coder", + "CoderOpen", + "CoderClose", + "CoderToggle", + "CoderProcess", + "CoderTree", + "CoderTreeView", + -- Ask commands + "CoderAsk", + "CoderAskToggle", + "CoderAskClear", + -- Agent commands + "CoderAgent", + "CoderAgentToggle", + "CoderAgentStop", + "CoderMode", + }, + keys = { + -- Coder view commands + { "co", "Coder open", desc = "Coder: Open view" }, + { "cC", "Coder close", desc = "Coder: Close view" }, + { "ct", "Coder toggle", desc = "Coder: Toggle view" }, + { "cp", "Coder process", desc = "Coder: Process prompt" }, + { "cs", "Coder status", desc = "Coder: Show status" }, + { "cf", "Coder focus", desc = "Coder: Switch focus" }, + { "cv", "Coder tree-view", desc = "Coder: View tree" }, + { "cr", "Coder tree", desc = "Coder: Refresh tree" }, + -- Ask panel commands + { "ca", "Coder ask", desc = "Coder: Open Ask panel" }, + { "cA", "Coder ask-toggle", desc = "Coder: Toggle Ask panel" }, + { "cx", "Coder ask-clear", desc = "Coder: Clear Ask history" }, + -- Agent panel commands + { "cg", "Coder agent", desc = "Coder: Open Agent panel" }, + { "cG", "Coder agent-toggle", desc = "Coder: Toggle Agent panel" }, + { "cS", "Coder agent-stop", desc = "Coder: Stop Agent" }, + { "cd", "CoderDiffReview", desc = "Coder: Open Diff Review" }, + -- Transform commands (inline /@ @/ replacement) + { "ctt", mode = "n", desc = "Coder: Transform tag at cursor" }, + { "ctt", mode = "v", desc = "Coder: Transform selected tags" }, + { "ctT", "Coder transform", desc = "Coder: Transform all tags" }, + }, + config = function() + require("codetyper").setup({ + llm = { + -- Available providers: "ollama", "claude", "openai", "gemini", "copilot" + provider = "copilot", -- Using GitHub Copilot + + -- Ollama (local LLM) + ollama = { + host = "http://localhost:11434", + model = "deepseek-coder:6.7b", + -- model = "codellama:7b", + -- model = "qwen2.5-coder:7b", + }, + + -- GitHub Copilot (uses OAuth from copilot.vim/copilot.lua) + copilot = { + model = "gpt-4o", -- or "gpt-4", "gpt-3.5-turbo" + }, + }, + window = { + width = 0.25, -- 1/4 of window + position = "left", + border = "rounded", + }, + patterns = { + open_tag = "/@", + close_tag = "@/", + file_pattern = "*.coder.*", + }, + auto_gitignore = true, + auto_open_ask = false, -- Don't auto-open Ask panel on startup + scheduler = { + enabled = true, + ollama_scout = false, -- Disabled since using Copilot directly + escalation_threshold = 0.7, + max_concurrent = 2, + completion_delay_ms = 100, -- Delay before checking completion visibility + apply_delay_ms = 2000, -- Wait 2 seconds before applying code + }, + }) + end, +} diff --git a/lua/cargdev/plugins/copilot.lua b/lua/cargdev/plugins/copilot.lua index 790c018..89f0bbc 100644 --- a/lua/cargdev/plugins/copilot.lua +++ b/lua/cargdev/plugins/copilot.lua @@ -28,7 +28,7 @@ return { }, suggestion = { enabled = true, - auto_trigger = true, + auto_trigger = false, debounce = 75, keymap = { accept = "", @@ -98,18 +98,22 @@ return { }, keys = { { "cc", "CopilotChatToggle", desc = "CopilotChat: Toggle chat window" }, - { "cq", function() + { + "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)" }, + end, + desc = "CopilotChat: Quick chat (whole buffer)", + }, { "ce", "CopilotChatExplain", mode = { "n", "v" }, desc = "CopilotChat: Explain code" }, { "cr", "CopilotChatReview", mode = { "n", "v" }, desc = "CopilotChat: Review code" }, { "cf", "CopilotChatFix", mode = { "n", "v" }, desc = "CopilotChat: Fix code" }, { "co", "CopilotChatOptimize", mode = { "n", "v" }, desc = "CopilotChat: Optimize code" }, { "cd", "CopilotChatDocs", mode = { "n", "v" }, desc = "CopilotChat: Generate docs" }, - { "ct", "CopilotChatTests", mode = { "n", "v" }, desc = "CopilotChat: Generate tests" }, + { "ctg", "CopilotChatTests", mode = { "n", "v" }, desc = "CopilotChat: Generate tests" }, { "cm", "CopilotChatModels", desc = "CopilotChat: Select model" }, }, config = function() diff --git a/lua/cargdev/plugins/fzf-lua.lua b/lua/cargdev/plugins/fzf-lua.lua new file mode 100644 index 0000000..fb8363d --- /dev/null +++ b/lua/cargdev/plugins/fzf-lua.lua @@ -0,0 +1,49 @@ +-- ============================================================================ +-- FZF-LUA: Fuzzy finder with LSP integration +-- ============================================================================ +-- High-performance fuzzy finder written in Lua. Provides fast file search, +-- grep, LSP navigation (definitions, references, implementations), git operations, +-- and more. Replaces Telescope for better performance and native fzf feel. +-- ============================================================================ +return { + "ibhagwan/fzf-lua", + dependencies = { "nvim-tree/nvim-web-devicons" }, + cmd = "FzfLua", + keys = { + { "ff", "FzfLua files", desc = "Find files" }, + { "fg", "FzfLua live_grep", desc = "Live grep" }, + { "fb", "FzfLua buffers", desc = "Find buffers" }, + { "fh", "FzfLua helptags", desc = "Find help" }, + { "fr", "FzfLua oldfiles", desc = "Recent files" }, + { "fc", "FzfLua commands", desc = "Find commands" }, + { "fk", "FzfLua keymaps", desc = "Find keymaps" }, + }, + opts = { + "default", + winopts = { + height = 0.85, + width = 0.80, + preview = { + horizontal = "right:50%", + }, + }, + keymap = { + builtin = { + [""] = "toggle-fullscreen", + [""] = "toggle-preview-wrap", + [""] = "toggle-preview", + [""] = "preview-page-down", + [""] = "preview-page-up", + }, + fzf = { + ["ctrl-a"] = "toggle-all", + ["ctrl-d"] = "preview-page-down", + ["ctrl-u"] = "preview-page-up", + }, + }, + fzf_opts = { + ["--layout"] = "reverse", + ["--info"] = "inline", + }, + }, +} diff --git a/lua/cargdev/plugins/grug-far.lua b/lua/cargdev/plugins/grug-far.lua index 83acab9..cb3b9de 100644 --- a/lua/cargdev/plugins/grug-far.lua +++ b/lua/cargdev/plugins/grug-far.lua @@ -3,7 +3,7 @@ -- ============================================================================ -- Powerful find and replace plugin with live preview and regex support. -- Provides project-wide search/replace with ripgrep backend. --- Keymaps: sr for search, sR for current word search. +-- Keymaps: sr for search, [sR for current word search. -- ============================================================================ return { @@ -47,17 +47,17 @@ return { windowCreationCommand = "vsplit", transitionDuration = 80, keymaps = { - replace = { n = "r" }, - qflist = { n = "q" }, - syncLocations = { n = "s" }, - syncLine = { n = "l" }, + replace = { n = "[r" }, + qflist = { n = "[q" }, + syncLocations = { n = "[s" }, + syncLine = { n = "[l" }, close = { n = "q" }, - historyOpen = { n = "t" }, - historyAdd = { n = "a" }, - refresh = { n = "f" }, - gotoLocation = { n = "" }, - pickHistoryEntry = { n = "" }, - abort = { n = "b" }, + historyOpen = { n = "[t" }, + historyAdd = { n = "[a" }, + refresh = { n = "[f" }, + gotoLocation = { n = "[" }, + pickHistoryEntry = { n = "[" }, + Abort = { n = "[b" }, }, }, } diff --git a/lua/cargdev/plugins/lsp/lspconfig.lua b/lua/cargdev/plugins/lsp/lspconfig.lua index 45d88cd..a7080a9 100644 --- a/lua/cargdev/plugins/lsp/lspconfig.lua +++ b/lua/cargdev/plugins/lsp/lspconfig.lua @@ -31,6 +31,7 @@ return { "graphql", "html", "lua_ls", + "php", "prismals", "pyright", "svelte", @@ -156,6 +157,7 @@ return { prismals = { filetypes = { "prisma" }, }, + php_ls = {}, pyright = { settings = { python = { diff --git a/lua/cargdev/plugins/lsp/mason.lua b/lua/cargdev/plugins/lsp/mason.lua index 04d4532..09c3161 100644 --- a/lua/cargdev/plugins/lsp/mason.lua +++ b/lua/cargdev/plugins/lsp/mason.lua @@ -45,6 +45,7 @@ return { "html", "jdtls", "lua_ls", + "php", "prismals", "pyright", "svelte",