diff --git a/lua/core/options.lua b/lua/core/options.lua index 5a009864..81f3b431 100644 --- a/lua/core/options.lua +++ b/lua/core/options.lua @@ -30,7 +30,7 @@ vim.o.splitright = true -- force all vertical split vim.o.swapfile = false -- creates a swapfile vim.o.smartindent = true -- make indenting smarter again vim.o.showmode = false -- we don't need to see things like -- INSERT -- anymore -vim.o.showtabline = 2 -- always show tabs +vim.o.showtabline = 0 -- always show tabs vim.o.backspace = 'indent,eol,start' -- allow backspace on vim.o.pumheight = 10 -- pop up menu height vim.o.conceallevel = 0 -- so that `` is visible in markdown files diff --git a/lua/plugins/avanti.lua b/lua/plugins/avanti.lua new file mode 100644 index 00000000..de6114f5 --- /dev/null +++ b/lua/plugins/avanti.lua @@ -0,0 +1,77 @@ +return{ { + "yetone/avante.nvim", + -- if you want to build from source then do `make BUILD_FROM_SOURCE=true` + -- ⚠️ must add this setting! ! ! + build = vim.fn.has("win32") ~= 0 + and "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" + or "make", + event = "VeryLazy", + version = false, -- Never set this value to "*"! Never! + ---@module 'avante' + ---@type avante.Config + opts = { + -- add any opts here + -- this file can contain specific instructions for your project + instructions_file = "avante.md", + -- for example + provider = "claude", + providers = { + claude = { + endpoint = "https://api.anthropic.com", + model = "claude-sonnet-4-20250514", + timeout = 30000, -- Timeout in milliseconds + extra_request_body = { + temperature = 0.75, + max_tokens = 20480, + }, + }, + moonshot = { + endpoint = "https://api.moonshot.ai/v1", + model = "kimi-k2-0711-preview", + timeout = 30000, -- Timeout in milliseconds + extra_request_body = { + temperature = 0.75, + max_tokens = 32768, + }, + }, + }, + }, + dependencies = { + "nvim-lua/plenary.nvim", + "MunifTanjim/nui.nvim", + --- The below dependencies are optional, + "nvim-mini/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 + "zbirenbaum/copilot.lua", -- for providers='copilot' + { + -- support for image pasting + "HakonHarnes/img-clip.nvim", + event = "VeryLazy", + opts = { + -- recommended settings + default = { + embed_image_as_base64 = false, + prompt_for_file_name = false, + drag_and_drop = { + insert_mode = true, + }, + -- required for Windows users + use_absolute_path = true, + }, + }, + }, + { + -- Make sure to set this up properly if you have lazy=true + 'MeanderingProgrammer/render-markdown.nvim', + opts = { + file_types = { "markdown", "Avante" }, + }, + ft = { "markdown", "Avante" }, + }, + }, +}} diff --git a/lua/plugins/claude.lua b/lua/plugins/claude.lua new file mode 100644 index 00000000..3104a42c --- /dev/null +++ b/lua/plugins/claude.lua @@ -0,0 +1,8 @@ +return { +{ + "avifenesh/claucode.nvim", + config = function() + require("claucode").setup() + end, +}, +} diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua index 3f7a0a51..f1d78d81 100644 --- a/lua/plugins/conform.lua +++ b/lua/plugins/conform.lua @@ -4,32 +4,23 @@ return { "stevearc/conform.nvim", event = { "BufReadPre", "BufNewFile" }, config = function() - -- Resolve templ binary (Mason first, else PATH) + -- Resolve templ binary local mason_templ = vim.fn.stdpath("data") .. "/mason/bin/templ" local templ_cmd = (vim.fn.executable(mason_templ) == 1) and mason_templ or ((vim.fn.executable("templ") == 1) and "templ" or nil) - if not templ_cmd then - vim.notify("[conform.nvim] Could not find `templ` binary. Install via Mason or PATH.", vim.log.levels.WARN) - end - require("conform").setup({ formatters = { templ_fmt = { command = templ_cmd or "templ", - -- Read source from stdin, tell templ the filename for correct rules, - -- and write formatted result to stdout (no in-place writes). args = { "fmt", "-stdin-filepath", "$FILENAME", "-stdout" }, stdin = true, }, - goimports = { - command = "goimports", - args = {}, - stdin = true, - }, + -- REMOVED manual goimports definition here. + -- Conform's built-in one works better. }, formatters_by_ft = { - templ = { "templ_fmt" }, -- ✅ only templ fmt for .templ + templ = { "templ_fmt" }, javascript = { "prettier" }, typescript = { "prettier" }, jsx = { "prettier" }, @@ -40,11 +31,18 @@ return { html = { "prettier" }, css = { "prettier" }, lua = { "stylua" }, - go = { "goimports", "gofmt" }, + -- Use goimports (which handles imports + fmt) + -- then gofmt (or gofumpt) as a secondary pass + go = { "goimports", "gofmt" }, }, format_on_save = function(bufnr) - if vim.bo[bufnr].filetype == "templ" then - return { timeout_ms = 2000, lsp_fallback = false } -- no LSP/Prettier fallback + local ft = vim.bo[bufnr].filetype + if ft == "templ" then + return { timeout_ms = 2000, lsp_fallback = false } + end + -- Increase timeout to 3000ms for Go to prevent the "timeout" issue + if ft == "go" then + return { timeout_ms = 3000, lsp_fallback = true } end return { timeout_ms = 1000, lsp_fallback = true } end, diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua index 3e36acd1..cf606643 100644 --- a/lua/plugins/debug.lua +++ b/lua/plugins/debug.lua @@ -41,8 +41,8 @@ return { vim.keymap.set('n', '', dap.step_into, { desc = 'Debug: Step Into' }) vim.keymap.set('n', '', dap.step_over, { desc = 'Debug: Step Over' }) vim.keymap.set('n', '', dap.step_out, { desc = 'Debug: Step Out' }) - vim.keymap.set('n', 'b', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) - vim.keymap.set('n', 'B', function() + vim.keymap.set('n', 'db', dap.toggle_breakpoint, { desc = 'Debug: Toggle Breakpoint' }) + vim.keymap.set('n', 'dB', function() dap.set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, { desc = 'Debug: Set Breakpoint' }) diff --git a/lua/plugins/lsp-keymaps.lua b/lua/plugins/lsp-keymaps.lua index d4c2ec30..f0d6b523 100644 --- a/lua/plugins/lsp-keymaps.lua +++ b/lua/plugins/lsp-keymaps.lua @@ -85,11 +85,11 @@ return { -- Core LSP maps vim.keymap.set("n", "cl", "LspInfo", opts("LSP Info")) - vim.keymap.set("n", "gd", goto_definition_preferring_source, opts("Go to Definition")) vim.keymap.set("n", "gr", vim.lsp.buf.references, opts("References")) vim.keymap.set("n", "gI", vim.lsp.buf.implementation, opts("Go to Implementation")) vim.keymap.set("n", "gy", vim.lsp.buf.type_definition, opts("Go to Type Definition")) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts("Go to Declaration")) + vim.keymap.set("n", "gd", goto_definition_preferring_source, opts("Go to Definition")) vim.keymap.set("n", "gK", vim.lsp.buf.signature_help, opts("Signature Help")) vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts("Signature Help")) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index 953fedee..1292bc27 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -64,9 +64,10 @@ return { "-dist","-build","-out","-coverage","-tmp","-.cache", }, semanticTokens = true, - memoryMode = "DegradeClosed", + -- memoryMode = "DegradeClosed", symbolMatcher = "FastFuzzy", ["ui.completion.experimentalPostfixCompletions"] = false, + vulncheck = "Imports", }, }, }) diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua index 44c64104..fcc1a5ed 100644 --- a/lua/plugins/lualine.lua +++ b/lua/plugins/lualine.lua @@ -37,7 +37,7 @@ return { } -- Import color theme based on environment variable NVIM_THEME - local env_var_nvim_theme = os.getenv 'NVIM_THEME' or 'nord' + local env_var_nvim_theme = os.getenv 'NVIM_THEME' or 'wombat' -- Define a table of themes local themes = { @@ -95,8 +95,8 @@ return { }, sections = { lualine_a = { mode }, - lualine_b = { 'branch' }, - lualine_c = { filename }, + lualine_c = { }, + lualine_b = { filename }, lualine_x = { diagnostics, diff, { 'encoding', cond = hide_in_width }, { 'filetype', cond = hide_in_width } }, lualine_y = { 'location' }, lualine_z = { 'progress' }, diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 1fa7970c..0401d056 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -4,9 +4,6 @@ return { branch = '0.1.x', dependencies = { 'nvim-lua/plenary.nvim', - -- Fuzzy Finder Algorithm which requires local dependencies to be built. - -- Only load if `make` is available. Make sure you have the system - -- requirements installed. { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make', @@ -15,30 +12,27 @@ return { end, }, 'nvim-telescope/telescope-ui-select.nvim', - - -- Useful for getting pretty icons, but requires a Nerd Font. 'nvim-tree/nvim-web-devicons', }, config = function() local telescope = require 'telescope' local actions = require 'telescope.actions' local builtin = require 'telescope.builtin' + local themes = require 'telescope.themes' - require('telescope').setup { + telescope.setup { defaults = { winblend = 0, mappings = { i = { - [''] = actions.move_selection_previous, -- move to prev result - [''] = actions.move_selection_next, -- move to next result - [''] = actions.select_default, -- open file - -- Enable paste from system clipboard + [''] = actions.move_selection_previous, + [''] = actions.move_selection_next, + [''] = actions.select_default, [''] = actions.paste_register, }, n = { ['q'] = actions.close, }, - }, }, pickers = { @@ -46,18 +40,65 @@ return { file_ignore_patterns = { 'node_modules', '.git', '.venv', 'query.sql.go', '*_templ.go' }, hidden = true, }, - buffers = { - initial_mode = 'normal', - sort_lastused = true, - -- sort_mru = true, - mappings = { - n = { - ['d'] = actions.delete_buffer, - ['l'] = actions.select_default, - }, - }, - }, + +-- Replace your current buffers picker block with this +buffers = themes.get_dropdown { + initial_mode = 'normal', + sort_lastused = true, + previewer = false, + layout_config = { width = 0.8, height = 0.5 }, + entry_maker = function(entry) + local devicons = require('nvim-web-devicons') + local entry_display = require('telescope.pickers.entry_display') + + local displayer = entry_display.create { + separator = " ", + items = { + { width = 2 }, -- Icon + { width = 45 }, -- Path + { width = 3 }, -- Modified [+] + { width = 6 }, -- Errors + { width = 6 }, -- Warnings }, + } + + local raw_path = entry.filename or entry.path or (entry.info and entry.info.name) or "unknown" + local relative_path = vim.fn.fnamemodify(raw_path, ":.") + local display_name = vim.fn.fnamemodify(raw_path, ":t") + local icon, icon_col = devicons.get_icon(display_name, string.match(display_name, "%.([^.]+)$"), { default = true }) + + -- Logic for Diagnostics + local errors = 0 + local warnings = 0 + if vim.api.nvim_buf_is_valid(entry.bufnr) then + errors = #vim.diagnostic.get(entry.bufnr, { severity = vim.diagnostic.severity.ERROR }) + warnings = #vim.diagnostic.get(entry.bufnr, { severity = vim.diagnostic.severity.WARN }) + end + + -- Check if buffer is modified + local modified = vim.api.nvim_get_option_value('modified', { buf = entry.bufnr }) and "[+]" or "" + + return { + value = entry, + ordinal = relative_path, + filename = raw_path, + bufnr = entry.bufnr, + display = function(ent) + return displayer { + { icon, icon_col }, + { relative_path, "TelescopeResultsComment" }, + { modified, "String" }, -- Greenish color for modified + { errors > 0 and (" " .. errors) or "", "DiagnosticError" }, + { warnings > 0 and (" " .. warnings) or "", "DiagnosticWarn" }, + } + end, + } + end, + mappings = { + i = { [""] = actions.delete_buffer }, + n = { ["d"] = actions.delete_buffer, ["l"] = actions.select_default }, + }, +}, }, live_grep = { file_ignore_patterns = { 'node_modules', '.git', '.venv' }, additional_args = function(_) @@ -71,7 +112,7 @@ return { }, extensions = { ['ui-select'] = { - require('telescope.themes').get_dropdown(), + themes.get_dropdown(), }, }, git_files = { @@ -79,41 +120,58 @@ return { }, } - -- Enable telescope fzf native, if installed - pcall(require('telescope').load_extension, 'fzf') - pcall(require('telescope').load_extension, 'ui-select') + -- Enable extensions + pcall(telescope.load_extension, 'fzf') + pcall(telescope.load_extension, 'ui-select') + -- KEYMAPS + -- The requested buffer modal + vim.keymap.set('n', 'b', builtin.buffers, { desc = '[B]uffers (Modal)' }) + + -- Your existing mappings vim.keymap.set('n', '?', builtin.oldfiles, { desc = '[?] Find recently opened files' }) vim.keymap.set('n', 'sb', builtin.buffers, { desc = '[S]earch existing [B]uffers' }) vim.keymap.set('n', 'sm', builtin.marks, { desc = '[S]earch [M]arks' }) - vim.keymap.set('n', 'gf', builtin.git_files, { desc = 'Search [G]it [F]iles' }) - vim.keymap.set('n', 'gc', builtin.git_commits, { desc = 'Search [G]it [C]ommits' }) - vim.keymap.set('n', 'gcf', builtin.git_bcommits, { desc = 'Search [G]it [C]ommits for current [F]ile' }) - vim.keymap.set('n', 'gb', builtin.git_branches, { desc = 'Search [G]it [B]ranches' }) - vim.keymap.set('n', 'gs', builtin.git_status, { desc = 'Search [G]it [S]tatus (diff view)' }) + -- vim.keymap.set('n', 'gf', builtin.git_files, { desc = 'Search [G]it [F]iles' }) + -- vim.keymap.set('n', 'gc', builtin.git_commits, { desc = 'Search [G]it [C]ommits' }) + -- vim.keymap.set('n', 'gcf', builtin.git_bcommits, { desc = 'Search [G]it [C]ommits for current [F]ile' }) + -- vim.keymap.set('n', 'gb', builtin.git_branches, { desc = 'Search [G]it [B]ranches' }) + -- vim.keymap.set('n', 'gs', builtin.git_status, { desc = 'Search [G]it [S]tatus (diff view)' }) vim.keymap.set('n', 'sf', builtin.find_files, { desc = '[S]earch [F]iles' }) vim.keymap.set('n', 'sh', builtin.help_tags, { desc = '[S]earch [H]elp' }) vim.keymap.set('n', 'sw', builtin.grep_string, { desc = '[S]earch current [W]ord' }) vim.keymap.set('n', 'sg', builtin.live_grep, { desc = '[S]earch by [G]rep' }) - vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) + -- vim.keymap.set('n', 'sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' }) vim.keymap.set('n', 'sr', builtin.resume, { desc = '[S]earch [R]resume' }) vim.keymap.set('n', 's.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' }) - vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[ ] Search Files' }) + vim.keymap.set('n', '', builtin.find_files, { desc = '[ ] Search Files' }) + -- Keymap to show errors across the entire project/open buffers + + +vim.keymap.set('n', 'se', function() + require('telescope.builtin').diagnostics(require('telescope.themes').get_dropdown({ + bufnr = nil, -- nil shows diagnostics for ALL buffers + severity = "ERROR", -- Only show Errors (ignores warnings/hints) + root_dir= true, + layout_config = { width = 0.8, height = 0.6 }, + })) +end, { desc = '[S]earch [E]rrors' }) + vim.keymap.set('n', 'sds', function() builtin.lsp_document_symbols { symbols = { 'Class', 'Function', 'Method', 'Constructor', 'Interface', 'Module', 'Property' }, } end, { desc = '[S]each LSP document [S]ymbols' }) - -- vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + vim.keymap.set('n', 's/', function() builtin.live_grep { grep_open_files = true, prompt_title = 'Live Grep in Open Files', } end, { desc = '[S]earch [/] in Open Files' }) + vim.keymap.set('n', '/', function() - -- You can pass additional configuration to telescope to change theme, layout, etc. - builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown { + builtin.current_buffer_fuzzy_find(themes.get_dropdown { previewer = false, }) end, { desc = '[/] Fuzzily search in current buffer' }) diff --git a/lua/plugins/windsurf.lua b/lua/plugins/windsurf.lua new file mode 100644 index 00000000..83243585 --- /dev/null +++ b/lua/plugins/windsurf.lua @@ -0,0 +1,26 @@ +-- Windsurf for LazyVim - Fixed syntax errors +return { + -- Windsurf plugin + { + "Exafunction/windsurf.nvim", + event = "InsertEnter", + dependencies = { + "nvim-lua/plenary.nvim", + "hrsh7th/nvim-cmp", + }, + keys = { + { "ct", "Codeium Toggle", desc = "Toggle Codeium" }, + }, + config = function() + require("codeium").setup({}) + + -- Add codeium to nvim-cmp sources after everything loads + vim.schedule(function() + local cmp = require('cmp') + local config = cmp.get_config() + table.insert(config.sources, 1, { name = "codeium" }) + cmp.setup(config) + end) + end, + }, +}