From a9b956e1419811e806ac9c76c95fa59c511673a5 Mon Sep 17 00:00:00 2001 From: Samuel ONeal Date: Mon, 19 Jan 2026 18:45:00 -0700 Subject: [PATCH] added more capabilities to my nvim setup --- lua/config/autocmds.lua | 8 +++++ lua/config/keymaps.lua | 34 +++++++++++++++++++ lua/config/options.lua | 48 ++++++++++++++++++--------- lua/overseer/template/user/go.lua | 8 +++++ lua/plugins/ai.lua | 21 ++++++++++-- lua/plugins/dap.lua | 55 ++++++++++++++++++------------- lua/plugins/dashboard.lua | 8 +++++ lua/plugins/devcontainer.lua | 10 ++++++ lua/plugins/editor.lua | 29 +++++++++++++--- lua/plugins/go-coverage.lua | 7 ++++ lua/plugins/go-profiling.lua | 10 ++++++ lua/plugins/lsp-roots.lua | 40 ++++++++++++++++++++++ lua/plugins/neotest-python.lua | 6 ++++ lua/plugins/neotest.lua | 19 +++++++++++ lua/plugins/overseer.lua | 8 +++++ lua/plugins/performance.lua | 15 +++++++++ lua/plugins/symbols.lua | 10 ++++++ lua/plugins/theme.lua | 20 +++++++++++ 18 files changed, 312 insertions(+), 44 deletions(-) create mode 100644 lua/overseer/template/user/go.lua create mode 100644 lua/plugins/dashboard.lua create mode 100644 lua/plugins/devcontainer.lua create mode 100644 lua/plugins/go-coverage.lua create mode 100644 lua/plugins/go-profiling.lua create mode 100644 lua/plugins/lsp-roots.lua create mode 100644 lua/plugins/neotest-python.lua create mode 100644 lua/plugins/neotest.lua create mode 100644 lua/plugins/overseer.lua create mode 100644 lua/plugins/performance.lua create mode 100644 lua/plugins/symbols.lua create mode 100644 lua/plugins/theme.lua diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 07ae15b..45c52db 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -106,3 +106,11 @@ autocmd("FileType", { vim.opt_local.spell = true end, }) + +autocmd("DirChanged", { + callback = function() + if vim.fn.filereadable(".devcontainer/devcontainer.json") == 1 then + vim.notify("Devcontainer detected", vim.log.levels.INFO) + end + end, +}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 614aa9d..09b1d6f 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -68,3 +68,37 @@ map("n", "at", "AvanteToggle", { desc = "AI Toggle" }) -- Database keymaps map("n", "db", "DBUIToggle", { desc = "Toggle DB UI" }) map("n", "da", "DBUIAddConnection", { desc = "Add DB Connection" }) + +-- Neotest +local neotest = require("neotest") + +map("n", "tt", neotest.run.run, { desc = "Run nearest test" }) +map("n", "tf", function() + neotest.run.run(vim.fn.expand("%")) +end, { desc = "Run test file" }) + +map("n", "ts", neotest.summary.toggle) +map("n", "to", neotest.output.open) +map("n", "tc", "Coverage", { desc = "Show coverage" }) + +-- Go benchmark +map("n", "gb", function() + vim.cmd("!go test -bench . ./...") +end, { desc = "Go benchmarks" }) +map("n", "gp", function() + vim.cmd("!go test -cpuprofile cpu.out && go tool pprof cpu.out") +end, { desc = "Go CPU profile" }) + +-- Overseer +map("n", "or", "OverseerRun", { desc = "Run task" }) +map("n", "ot", "OverseerToogle", { desc = "Task list" }) + +-- Aerial +map("n", "so", "AerialToggle", { desc = "Symbols outline" }) +map("n", "sh", vim.lsp.buf.incoming_calls, { desc = "Incoming calls" }) +map("n", "sc", vim.lsp.buf.outgoing_calls, { desc = "Outgoing calls" }) + +-- Diagnostics +map("n", "xx", "Trouble diagnostics toggle") +map("n", "xw", "Trouble workspace_diagnostics") +map("n", "xt", "Trouble todo") diff --git a/lua/config/options.lua b/lua/config/options.lua index ab53989..d33a0e6 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -3,35 +3,40 @@ local opt = vim.opt +if vim.env.SSH_CONNECTION then + opt.clipboard = "" + opt.timeoutlen = 1000 +end + -- General opt.clipboard = "unnamedplus" -- Sync with system clipboard -opt.confirm = true -- Confirm before closing unsaved buffer -opt.cursorline = true -- Highlight current line -opt.mouse = "a" -- Enable mouse -opt.number = true -- Show line numbers -opt.relativenumber = true -- Relative line numbers -opt.signcolumn = "yes" -- Always show sign column -opt.termguicolors = true -- True color support -opt.wrap = false -- Disable line wrap +opt.confirm = true -- Confirm before closing unsaved buffer +opt.cursorline = true -- Highlight current line +opt.mouse = "a" -- Enable mouse +opt.number = true -- Show line numbers +opt.relativenumber = true -- Relative line numbers +opt.signcolumn = "yes" -- Always show sign column +opt.termguicolors = true -- True color support +opt.wrap = true -- Disable line wrap -- Indentation -opt.expandtab = true -- Use spaces instead of tabs -opt.shiftwidth = 2 -- Size of indent -opt.tabstop = 2 -- Number of spaces tabs count for +opt.expandtab = true -- Use spaces instead of tabs +opt.shiftwidth = 2 -- Size of indent +opt.tabstop = 2 -- Number of spaces tabs count for opt.smartindent = true -- Smart indentation -- Search opt.ignorecase = true -- Ignore case -opt.smartcase = true -- Don't ignore case with capitals -opt.hlsearch = true -- Highlight search results -opt.incsearch = true -- Show search results as you type +opt.smartcase = true -- Don't ignore case with capitals +opt.hlsearch = true -- Highlight search results +opt.incsearch = true -- Show search results as you type -- Split behavior opt.splitbelow = true -- Put new windows below current opt.splitright = true -- Put new windows right of current -- Undo -opt.undofile = true -- Persistent undo +opt.undofile = true -- Persistent undo opt.undolevels = 10000 -- Maximum undo levels -- Performance @@ -45,3 +50,16 @@ opt.completeopt = "menu,menuone,noselect" opt.foldmethod = "expr" opt.foldexpr = "nvim_treesitter#foldexpr()" opt.foldlevel = 99 -- Start with all folds open + +opt.exrc = true +opt.secure = true + +vim.diagnostic.config({ + virtual_text = { + prefix = "●", + }, + severity_sort = true, + float = { + border = "rounded", + }, +}) diff --git a/lua/overseer/template/user/go.lua b/lua/overseer/template/user/go.lua new file mode 100644 index 0000000..344ae57 --- /dev/null +++ b/lua/overseer/template/user/go.lua @@ -0,0 +1,8 @@ +return { + name = "go test", + builder = function() + return { + cmd = { "go", "test", "./..." }, + } + end, +} diff --git a/lua/plugins/ai.lua b/lua/plugins/ai.lua index 56d5c00..551827d 100644 --- a/lua/plugins/ai.lua +++ b/lua/plugins/ai.lua @@ -44,7 +44,7 @@ return { opts = { -- Default provider (switch with :AvanteProvider command) -- Options: "claude", "openai", "azure", "gemini", "copilot", "cohere" - provider = "claude", + provider = "openai", -- Provider configurations providers = { @@ -59,7 +59,7 @@ return { }, openai = { endpoint = "https://api.openai.com/v1", - model = "gpt-4o", + model = "gpt-4o-mini", timeout = 30000, extra_request_body = { temperature = 0.75, @@ -193,4 +193,21 @@ return { }, }, }, + { + "zbirenbaum/copilot.lua", + cmd = "Copilot", + event = "InsertEnter", + opts = { + suggestion = { + enabled = true, + auto_trigger = true, + keymap = { + accept = "", + next = "", + prev = "", + }, + }, + panel = { enabled = false }, + }, + } } diff --git a/lua/plugins/dap.lua b/lua/plugins/dap.lua index c880cf9..e682163 100644 --- a/lua/plugins/dap.lua +++ b/lua/plugins/dap.lua @@ -63,24 +63,24 @@ return { keys = { -- Debug keymaps { "dB", function() require("dap").set_breakpoint(vim.fn.input("Breakpoint condition: ")) end, desc = "Breakpoint Condition" }, - { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, - { "dc", function() require("dap").continue() end, desc = "Continue" }, - { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, - { "dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, - { "di", function() require("dap").step_into() end, desc = "Step Into" }, - { "dj", function() require("dap").down() end, desc = "Down" }, - { "dk", function() require("dap").up() end, desc = "Up" }, - { "dl", function() require("dap").run_last() end, desc = "Run Last" }, - { "do", function() require("dap").step_out() end, desc = "Step Out" }, - { "dO", function() require("dap").step_over() end, desc = "Step Over" }, - { "dp", function() require("dap").pause() end, desc = "Pause" }, - { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, - { "ds", function() require("dap").session() end, desc = "Session" }, - { "dt", function() require("dap").terminate() end, desc = "Terminate" }, - { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, + { "db", function() require("dap").toggle_breakpoint() end, desc = "Toggle Breakpoint" }, + { "dc", function() require("dap").continue() end, desc = "Continue" }, + { "dC", function() require("dap").run_to_cursor() end, desc = "Run to Cursor" }, + { "dg", function() require("dap").goto_() end, desc = "Go to Line (No Execute)" }, + { "di", function() require("dap").step_into() end, desc = "Step Into" }, + { "dj", function() require("dap").down() end, desc = "Down" }, + { "dk", function() require("dap").up() end, desc = "Up" }, + { "dl", function() require("dap").run_last() end, desc = "Run Last" }, + { "do", function() require("dap").step_out() end, desc = "Step Out" }, + { "dO", function() require("dap").step_over() end, desc = "Step Over" }, + { "dp", function() require("dap").pause() end, desc = "Pause" }, + { "dr", function() require("dap").repl.toggle() end, desc = "Toggle REPL" }, + { "ds", function() require("dap").session() end, desc = "Session" }, + { "dt", function() require("dap").terminate() end, desc = "Terminate" }, + { "dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" }, -- Go-specific - { "dT", function() require("dap-go").debug_test() end, desc = "Debug Go Test" }, - { "dL", function() require("dap-go").debug_last_test() end, desc = "Debug Last Go Test" }, + { "dT", function() require("dap-go").debug_test() end, desc = "Debug Go Test" }, + { "dL", function() require("dap-go").debug_last_test() end, desc = "Debug Last Go Test" }, }, }, @@ -93,23 +93,23 @@ return { }, keys = { { "du", function() require("dapui").toggle({}) end, desc = "Dap UI" }, - { "de", function() require("dapui").eval() end, desc = "Eval", mode = { "n", "v" } }, + { "de", function() require("dapui").eval() end, desc = "Eval", mode = { "n", "v" } }, }, opts = { layouts = { { elements = { - { id = "scopes", size = 0.25 }, + { id = "scopes", size = 0.25 }, { id = "breakpoints", size = 0.25 }, - { id = "stacks", size = 0.25 }, - { id = "watches", size = 0.25 }, + { id = "stacks", size = 0.25 }, + { id = "watches", size = 0.25 }, }, position = "left", size = 40, }, { elements = { - { id = "repl", size = 0.5 }, + { id = "repl", size = 0.5 }, { id = "console", size = 0.5 }, }, position = "bottom", @@ -135,7 +135,16 @@ return { end end, }, - + { + "jay-babu/mason-nvim-dap.nvim", + opts = { + ensure_installed = { + "go", + "python", + "node2", + }, + }, + }, -- Virtual text for debugging { "theHamsta/nvim-dap-virtual-text", diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua new file mode 100644 index 0000000..7f02db7 --- /dev/null +++ b/lua/plugins/dashboard.lua @@ -0,0 +1,8 @@ +return { + { + "folke/trouble.nvim", + opts = { + use_diagnostic_signs = true, + }, + }, +} diff --git a/lua/plugins/devcontainer.lua b/lua/plugins/devcontainer.lua new file mode 100644 index 0000000..72b90e4 --- /dev/null +++ b/lua/plugins/devcontainer.lua @@ -0,0 +1,10 @@ +return { + { + "jamestthompson3/nvim-remote-containers", + cmd = { + "AttachToContainer", + "BuildImage", + "StartImage", + }, + }, +} diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 390eaa5..c541810 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -2,6 +2,27 @@ -- Custom keybindings for file explorer (snacks.nvim built into LazyVim) return { + { + "nvim-telescope/telescope.nvim", + opts = { + defaults = { + hidden = true, + file_ignore_patterns = {}, + }, + pickers = { + find_files = { + hidden = true, + no_ignore = true, + no_ignore_parent = true, + }, + live_grep = { + additional_args = function() + return { "--hidden", "--no-ignore" } + end, + }, + }, + }, + }, -- Configure snacks.nvim explorer (already included in LazyVim) { "folke/snacks.nvim", @@ -39,12 +60,12 @@ return { }, keys = { -- Ctrl+Shift+e - Toggle explorer - { "", function() Snacks.explorer() end, desc = "Toggle Explorer" }, + { "", function() Snacks.explorer() end, desc = "Toggle Explorer" }, -- Alternative binding if terminal doesn't handle Ctrl+Shift - { "fe", function() Snacks.explorer() end, desc = "File Explorer" }, + { "fe", function() Snacks.explorer() end, desc = "File Explorer" }, -- Lazygit - { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, - { "gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log" }, + { "gg", function() Snacks.lazygit() end, desc = "Lazygit" }, + { "gl", function() Snacks.lazygit.log() end, desc = "Lazygit Log" }, { "gf", function() Snacks.lazygit.log_file() end, desc = "Lazygit File History" }, }, }, diff --git a/lua/plugins/go-coverage.lua b/lua/plugins/go-coverage.lua new file mode 100644 index 0000000..e408886 --- /dev/null +++ b/lua/plugins/go-coverage.lua @@ -0,0 +1,7 @@ +return { + { + "andythigpen/nvim-coverage", + dependencies = "nvim-lua/plenary.nvim", + config = true, + }, +} diff --git a/lua/plugins/go-profiling.lua b/lua/plugins/go-profiling.lua new file mode 100644 index 0000000..1014e0a --- /dev/null +++ b/lua/plugins/go-profiling.lua @@ -0,0 +1,10 @@ +return { + { + "davecheney/profile", + ft = "go", + }, + { + "rbong/vim-flog", + cmd = { "Flog" }, + }, +} diff --git a/lua/plugins/lsp-roots.lua b/lua/plugins/lsp-roots.lua new file mode 100644 index 0000000..4986318 --- /dev/null +++ b/lua/plugins/lsp-roots.lua @@ -0,0 +1,40 @@ +return { + { + "neovim/nvim-lspconfig", + opts = { + servers = { + tsserver = { + root_dir = function(fname) + return require("lspconfig.util").root_pattern( + "pnpm-workspace.yaml", + "nx.json", + "turbo.json", + "package.json", + ".git" + )(fname) + end, + }, + + gopls = { + root_dir = function(fname) + return require("lspconfig.util").root_pattern( + "go.work", + "go.mod", + ".git" + )(fname) + end, + }, + + pyright = { + root_dir = function(fname) + return require("lspconfig.util").root_pattern( + "pyproject.toml", + "setup.py", + ".git" + )(fname) + end, + }, + }, + }, + }, +} diff --git a/lua/plugins/neotest-python.lua b/lua/plugins/neotest-python.lua new file mode 100644 index 0000000..29e84b2 --- /dev/null +++ b/lua/plugins/neotest-python.lua @@ -0,0 +1,6 @@ +return { + { + "nvim-neotest/neotest-python", + dependencies = { "nvim-neotest/neotest" }, + }, +} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..cbcbbfe --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,19 @@ +return { + { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-neotest/neotest-go", + }, + opts = { + adapters = { + require("neotest-go"), + require("neotest-python")({ + dap = { justMyCode = false }, + }), + }, + }, + }, +} diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua new file mode 100644 index 0000000..1ec04e7 --- /dev/null +++ b/lua/plugins/overseer.lua @@ -0,0 +1,8 @@ +return { + { + "stevearc/overseer.nvim", + opts = { + templates = { "builtin", "user.go", "user.npm" } + }, + }, +} diff --git a/lua/plugins/performance.lua b/lua/plugins/performance.lua new file mode 100644 index 0000000..8b5f977 --- /dev/null +++ b/lua/plugins/performance.lua @@ -0,0 +1,15 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + opts = { + highlight = { + enable = true, + disable = function(_, buf) + local max_filesize = 200 * 1024 -- 200 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + return ok and stats and stats.size > max_filesize + end, + }, + }, + } +} diff --git a/lua/plugins/symbols.lua b/lua/plugins/symbols.lua new file mode 100644 index 0000000..6dc80e7 --- /dev/null +++ b/lua/plugins/symbols.lua @@ -0,0 +1,10 @@ +return { + { + "stevearc/aerial.nvim", + opts = { + layout = { + max_width = 40, + }, + }, + }, +} diff --git a/lua/plugins/theme.lua b/lua/plugins/theme.lua new file mode 100644 index 0000000..5ffc9c3 --- /dev/null +++ b/lua/plugins/theme.lua @@ -0,0 +1,20 @@ +return { + { + "catppuccin/nvim", + name = "catppuccin", + priority = 1000, + opts = { + integrations = { + treesitter = true, + cmp = true, + gitsigns = true, + neotest = true, + dap = true, + }, + }, + config = function(_, opts) + require("catppuccin").setup(opts) + vim.cmd.colorscheme("catppuccin-mocha") + end, + }, +}