From 87aa44576408407614df86b4927eccf75e8ee279 Mon Sep 17 00:00:00 2001 From: Carlos Date: Sun, 6 Jul 2025 14:37:08 -0400 Subject: [PATCH] chore: adding more configurations --- lua/cargdev/core/keymaps.lua | 1 + lua/cargdev/plugins/aicargdev.lua.bak | 56 +++++++++++++++++++ .../plugins/{aicargdev.lua => avante.lua} | 34 ++++++----- lua/cargdev/plugins/buffertabs.lua.bak | 12 ---- lua/cargdev/plugins/copilot.lua | 5 +- lua/cargdev/plugins/lsp/lspconfig.lua | 48 +++++++++------- lua/cargdev/plugins/lsp/mason.lua | 2 +- 7 files changed, 110 insertions(+), 48 deletions(-) create mode 100644 lua/cargdev/plugins/aicargdev.lua.bak rename lua/cargdev/plugins/{aicargdev.lua => avante.lua} (51%) delete mode 100644 lua/cargdev/plugins/buffertabs.lua.bak diff --git a/lua/cargdev/core/keymaps.lua b/lua/cargdev/core/keymaps.lua index 6b40e0e..24f1e6f 100644 --- a/lua/cargdev/core/keymaps.lua +++ b/lua/cargdev/core/keymaps.lua @@ -94,6 +94,7 @@ keymap.set("n", "ld", "Leet daily", { desc = "LeetCode: Daily C keymap.set("n", "ll", "Leet list", { desc = "LeetCode: List Problems" }) keymap.set("n", "lc", "Leet console", { desc = "LeetCode: Open Console" }) keymap.set("n", "lu", "Leet cookie update", { desc = "LeetCode: Update Cookie" }) +keymap.set("n", "lls", "Leet last_submit", { desc = "LeetCode: Get latest submition" }) -- Copilot -- Add key map on normal mode to open copilot panel on c + tab diff --git a/lua/cargdev/plugins/aicargdev.lua.bak b/lua/cargdev/plugins/aicargdev.lua.bak new file mode 100644 index 0000000..c53fccd --- /dev/null +++ b/lua/cargdev/plugins/aicargdev.lua.bak @@ -0,0 +1,56 @@ +-- return { +-- { +-- "yetone/avante.nvim", +-- event = "VeryLazy", +-- lazy = false, +-- version = false, -- Always pull the latest change +-- opts = { +-- provider = "cargdev", -- API provider configuration +-- providers = { +-- cargdev = { +-- name = "cargdev", -- Optional +-- endpoint = "https://api-ai.cargdev.io", -- API endpoint +-- api_key_name = "CARGDEV_API_KEY", -- reference the ENV VAR below +-- model = "deepseek-r1:latest", +-- __inherited_from = "ollama", -- ensures compatibility +-- max_tokens = 8192, +-- }, +-- }, +-- }, +-- -- Optional: Build from source if required +-- build = "make", +-- dependencies = { +-- "nvim-treesitter/nvim-treesitter", -- Syntax highlighting support +-- "stevearc/dressing.nvim", -- UI elements +-- "nvim-lua/plenary.nvim", -- Utility library +-- "MunifTanjim/nui.nvim", -- UI library for modal components +-- -- Optional dependencies: +-- "nvim-tree/nvim-web-devicons", -- Icons support +-- "zbirenbaum/copilot.lua", -- Copilot integration +-- { +-- "HakonHarnes/img-clip.nvim", -- Image pasting support +-- event = "VeryLazy", +-- opts = { +-- -- Recommended settings +-- default = { +-- embed_image_as_base64 = false, +-- prompt_for_file_name = false, +-- drag_and_drop = { +-- insert_mode = true, +-- }, +-- use_absolute_path = true, -- For Windows users +-- }, +-- }, +-- }, +-- { +-- "MeanderingProgrammer/render-markdown.nvim", +-- ft = { "markdown", "Avante" }, +-- config = function() +-- require("render-markdown").setup({ +-- file_types = { "markdown", "Avante" }, +-- }) +-- end, +-- }, +-- }, +-- }, +-- } diff --git a/lua/cargdev/plugins/aicargdev.lua b/lua/cargdev/plugins/avante.lua similarity index 51% rename from lua/cargdev/plugins/aicargdev.lua rename to lua/cargdev/plugins/avante.lua index 3d20692..0ef2ad3 100644 --- a/lua/cargdev/plugins/aicargdev.lua +++ b/lua/cargdev/plugins/avante.lua @@ -5,28 +5,32 @@ return { lazy = false, version = false, -- Always pull the latest change opts = { - provider = "cargdev", -- API provider configuration + provider = "claude", -- API provider configuration providers = { - cargdev = { - name = "cargdev", -- Optional - endpoint = "https://api-ai.cargdev.io", -- API endpoint - api_key_name = "CARGDEV_API_KEY", -- reference the ENV VAR below - model = "deepseek-r1:latest", - __inherited_from = "ollama", -- ensures compatibility - max_tokens = 8192, + claude = { + endpoint = "https://api.anthropic.com", + model = "claude-3-haiku-20240307", + timeout = 30000, -- Timeout in milliseconds + extra_request_body = { + temperature = 0.75, + max_tokens = 4096, + }, }, }, }, -- Optional: Build from source if required build = "make", dependencies = { - "nvim-treesitter/nvim-treesitter", -- Syntax highlighting support - "stevearc/dressing.nvim", -- UI elements - "nvim-lua/plenary.nvim", -- Utility library - "MunifTanjim/nui.nvim", -- UI library for modal components - -- Optional dependencies: - "nvim-tree/nvim-web-devicons", -- Icons support - "zbirenbaum/copilot.lua", -- Copilot integration + "nvim-treesitter/nvim-treesitter", + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + "echasnovski/mini.pick", -- for file_selector provider mini.pick + "nvim-telescope/telescope.nvim", -- for file_selector provider telescope + "hrsh7th/nvim-cmp", -- autocompletion for avante commands and mentions + "ibhagwan/fzf-lua", -- for file_selector provider fzf + "stevearc/dressing.nvim", -- for input provider dressing + "folke/snacks.nvim", -- for input provider snacks + "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons { "HakonHarnes/img-clip.nvim", -- Image pasting support event = "VeryLazy", diff --git a/lua/cargdev/plugins/buffertabs.lua.bak b/lua/cargdev/plugins/buffertabs.lua.bak deleted file mode 100644 index 5c04112..0000000 --- a/lua/cargdev/plugins/buffertabs.lua.bak +++ /dev/null @@ -1,12 +0,0 @@ --- return { --- "ap/vim-buftabline", --- event = "VeryLazy", -- Loads when Neovim starts up --- config = function() --- -- Enable the buffer tabline --- vim.g.buftabline_numbers = 2 -- Shows buffer numbers --- vim.g.buftabline_separators = 1 -- Shows separators between tabs --- vim.g.buftabline_indicators = 1 -- Show indicators for modified buffers --- vim.g.buftabline_show = 1 -- 0: never, 1: always, 2: auto-hide when only one buffer --- vim.g.buftabline_modified_indicator = "[+]" -- Custom indicator for modified buffers --- end, --- } diff --git a/lua/cargdev/plugins/copilot.lua b/lua/cargdev/plugins/copilot.lua index 994b60d..04bfb1e 100644 --- a/lua/cargdev/plugins/copilot.lua +++ b/lua/cargdev/plugins/copilot.lua @@ -23,7 +23,7 @@ return { }, suggestion = { enabled = true, - auto_trigger = false, + auto_trigger = true, debounce = 75, trigger_on_accept = false, keymap = { @@ -54,6 +54,9 @@ return { position = "right", -- Position of the chat window ratio = 0.5, }, + tiktoken = { + enabled = false, -- Enable token counting + }, floating = { enabled = true, border = "rounded", diff --git a/lua/cargdev/plugins/lsp/lspconfig.lua b/lua/cargdev/plugins/lsp/lspconfig.lua index 58aac5f..df168f9 100644 --- a/lua/cargdev/plugins/lsp/lspconfig.lua +++ b/lua/cargdev/plugins/lsp/lspconfig.lua @@ -5,7 +5,10 @@ return { "hrsh7th/cmp-nvim-lsp", { "antosha417/nvim-lsp-file-operations", config = true }, { "folke/neodev.nvim", opts = {} }, - { "pmizio/typescript-tools.nvim", dependencies = { "nvim-lua/plenary.nvim" } } + { + "pmizio/typescript-tools.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + }, }, config = function() local lspconfig = require("lspconfig") @@ -21,31 +24,29 @@ return { "gopls", "graphql", "html", - "jdtls", + -- "jdtls", -- uncomment if you’re actively doing Java "lua_ls", "prismals", "pyright", "svelte", "tailwindcss", - "ts_ls" - } + }, }) local capabilities = cmp_nvim_lsp.default_capabilities() - -- Define signs for diagnostics vim.diagnostic.config({ signs = { severity = { - min = vim.diagnostic.severity.WARN + min = vim.diagnostic.severity.WARN, }, icons = { Error = " ", Warn = " ", Hint = "󰠠 ", - Info = " " - } - } + Info = " ", + }, + }, }) local servers = { @@ -55,23 +56,22 @@ return { gopls = {}, graphql = {}, html = {}, - jdtls = {}, + -- jdtls = {}, -- same here lua_ls = { settings = { Lua = { diagnostics = { globals = { "vim" } }, workspace = { library = vim.api.nvim_get_runtime_file("", true), - checkThirdParty = false - } - } - } + checkThirdParty = false, + }, + }, + }, }, prismals = {}, pyright = {}, svelte = {}, tailwindcss = {}, - ts_ls = {} } for server, config in pairs(servers) do @@ -79,6 +79,16 @@ return { lspconfig[server].setup(config) end + -- ✅ Correct way to setup typescript-tools + require("typescript-tools").setup({ + capabilities = capabilities, + -- optional settings: + -- settings = { + -- tsserver_plugins = {}, + -- tsserver_max_memory = 4096, + -- } + }) + vim.api.nvim_create_autocmd("LspAttach", { group = vim.api.nvim_create_augroup("UserLspConfig", {}), callback = function(ev) @@ -96,7 +106,7 @@ return { ["[d"] = { vim.diagnostic.goto_prev, "Go to previous diagnostic" }, ["]d"] = { vim.diagnostic.goto_next, "Go to next diagnostic" }, ["K"] = { vim.lsp.buf.hover, "Show documentation for cursor" }, - ["rs"] = { ":LspRestart", "Restart LSP" } + ["rs"] = { ":LspRestart", "Restart LSP" }, } for key, map in pairs(mappings) do @@ -107,11 +117,11 @@ return { buffer = ev.buf, callback = function() vim.diagnostic.open_float(nil, { focusable = false }) - end + end, }) vim.o.updatetime = 250 - end + end, }) - end + end, } diff --git a/lua/cargdev/plugins/lsp/mason.lua b/lua/cargdev/plugins/lsp/mason.lua index daf50a8..8f6e8df 100644 --- a/lua/cargdev/plugins/lsp/mason.lua +++ b/lua/cargdev/plugins/lsp/mason.lua @@ -27,7 +27,7 @@ return { mason_lspconfig.setup({ -- list of servers for mason to install ensure_installed = { - "tsserver", + "ts_ls", "html", "cssls", "tailwindcss",