From 3b41bd1552170f069d235f84e66a77a8b0f7cb9f Mon Sep 17 00:00:00 2001 From: Samuel ONeal Date: Mon, 19 Jan 2026 19:31:11 -0700 Subject: [PATCH] Added more editor features to support Golang, sql and git --- lazy-lock.json | 27 ++++++++++++----- lua/config/autocmds.lua | 26 +++++++++++++++++ lua/config/keymaps.lua | 15 ++++++++-- lua/overseer/template/user/go.lua | 8 ----- lua/overseer/template/user/go_bench.lua | 15 ++++++++++ lua/overseer/template/user/go_cpu_profile.lua | 20 +++++++++++++ lua/overseer/template/user/go_mem_profile.lua | 20 +++++++++++++ lua/overseer/template/user/go_test.lua | 10 +++++++ lua/overseer/template/user/go_trace.lua | 20 +++++++++++++ lua/plugins/dadbod.lua | 1 + lua/plugins/formatting.lua | 6 ++-- lua/plugins/git.lua | 15 ++++++++++ lua/plugins/go-profiling.lua | 10 ------- lua/plugins/neotest-python.lua | 6 ---- lua/plugins/neotest.lua | 29 ++++++++++++++----- lua/plugins/overseer.lua | 2 +- 16 files changed, 184 insertions(+), 46 deletions(-) delete mode 100644 lua/overseer/template/user/go.lua create mode 100644 lua/overseer/template/user/go_bench.lua create mode 100644 lua/overseer/template/user/go_cpu_profile.lua create mode 100644 lua/overseer/template/user/go_mem_profile.lua create mode 100644 lua/overseer/template/user/go_test.lua create mode 100644 lua/overseer/template/user/go_trace.lua create mode 100644 lua/plugins/git.lua delete mode 100644 lua/plugins/go-profiling.lua delete mode 100644 lua/plugins/neotest-python.lua diff --git a/lazy-lock.json b/lazy-lock.json index c137248..3d0d5e9 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,11 +1,15 @@ { + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LazyVim": { "branch": "main", "commit": "28db03f958d58dfff3c647ce28fdc1cb88ac158d" }, - "SchemaStore.nvim": { "branch": "main", "commit": "20ee0cad0b25e4a028d355c51b06d41eecb90d91" }, + "SchemaStore.nvim": { "branch": "main", "commit": "fb7b9034285a5658c746faa12eff8c1c9d9b11b1" }, + "aerial.nvim": { "branch": "master", "commit": "7a6a42791eb2b54a7115c7db4488981f93471770" }, "avante.nvim": { "branch": "main", "commit": "e89eb79abf5754645e20aa6074da10ed20bba33c" }, "blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" }, "bufferline.nvim": { "branch": "main", "commit": "655133c3b4c3e5e05ec549b9f8cc2894ac6f51b3" }, "catppuccin": { "branch": "main", "commit": "beaf41a30c26fd7d6c386d383155cbd65dd554cd" }, - "conform.nvim": { "branch": "master", "commit": "238f542a118984a88124fc915d5b981680418707" }, + "conform.nvim": { "branch": "master", "commit": "c2526f1cde528a66e086ab1668e996d162c75f4f" }, + "copilot.lua": { "branch": "master", "commit": "2d7511494245129aa6c2176f9c71cc2bc1360ed9" }, + "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" }, "dressing.nvim": { "branch": "master", "commit": "2d7c2db2507fa3c4956142ee607431ddb2828639" }, "flash.nvim": { "branch": "main", "commit": "fcea7ff883235d9024dc41e638f164a450c14ca2" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, @@ -16,15 +20,21 @@ "lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" }, "lualine.nvim": { "branch": "master", "commit": "47f91c416daef12db467145e16bed5bbfe00add8" }, "markdown-preview.nvim": { "branch": "master", "commit": "a923f5fc5ba36a3b17e289dc35dc17f66d0548ee" }, - "mason-lspconfig.nvim": { "branch": "main", "commit": "fe661093f4b05136437b531e7f959af2a2ae66c8" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "80c0130c5f16b551865a69e832f1feadeedb5fbe" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" }, "mason.nvim": { "branch": "main", "commit": "44d1e90e1f66e077268191e3ee9d2ac97cc18e65" }, - "mini.ai": { "branch": "main", "commit": "bfb26d9072670c3aaefab0f53024b2f3729c8083" }, + "mini.ai": { "branch": "main", "commit": "9eae720f2b20f6ad28cbfa0ddc524e10dc2c3201" }, "mini.icons": { "branch": "main", "commit": "efc85e42262cd0c9e1fdbf806c25cb0be6de115c" }, "mini.pairs": { "branch": "main", "commit": "d5a29b6254dad07757832db505ea5aeab9aad43a" }, + "neogit": { "branch": "master", "commit": "d8bf9102692250193b855acd9025a826f1af2729" }, + "neotest": { "branch": "master", "commit": "deadfb1af5ce458742671ad3a013acb9a6b41178" }, + "neotest-go": { "branch": "main", "commit": "59b50505053f9c45a9febb79e11a56206c3e3901" }, + "neotest-golang": { "branch": "main", "commit": "53f06063780b0b244583d3d32b138fc2df21e162" }, + "neotest-python": { "branch": "master", "commit": "b0d3a861bd85689d8ed73f0590c47963a7eb1bf9" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-colorizer.lua": { "branch": "master", "commit": "81e676d3203c9eb6e4c0ccf1eba1679296ef923f" }, + "nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" }, "nvim-dap": { "branch": "master", "commit": "cdfd55a133f63228c55f91378f12908cb2a78ded" }, "nvim-dap-go": { "branch": "main", "commit": "b4421153ead5d726603b02743ea40cf26a51ed5f" }, "nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" }, @@ -32,14 +42,17 @@ "nvim-lint": { "branch": "master", "commit": "ca6ea12daf0a4d92dc24c5c9ae22a1f0418ade37" }, "nvim-lspconfig": { "branch": "master", "commit": "92ee7d42320edfbb81f3cad851314ab197fa324a" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, - "nvim-treesitter": { "branch": "main", "commit": "5a7e5638e7d220575b1c22c8a2e099b52231886e" }, - "nvim-treesitter-textobjects": { "branch": "main", "commit": "baa6b4ec28c8be5e4a96f9b1b6ae9db85ec422f8" }, + "nvim-remote-containers": { "branch": "master", "commit": "73c2cbc59b69b4026682aea6bab225831fb8eaa4" }, + "nvim-treesitter": { "branch": "main", "commit": "e75c007f2747050c2c620dc862c77b8f242551a8" }, + "nvim-treesitter-textobjects": { "branch": "main", "commit": "4d55f63252e04c5212daed958e4e940915ff16ce" }, "nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" }, "nvim-web-devicons": { "branch": "master", "commit": "803353450c374192393f5387b6a0176d0972b848" }, + "overseer.nvim": { "branch": "master", "commit": "5828bdbd86677497613033c142f0a8624489216f" }, "persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, - "render-markdown.nvim": { "branch": "main", "commit": "ae89236e2389836cf1c3787b2b80d5d8685cc13f" }, + "render-markdown.nvim": { "branch": "main", "commit": "c54380dd4d8d1738b9691a7c349ecad7967ac12e" }, "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" }, + "telescope.nvim": { "branch": "master", "commit": "0d8b6eaa0b5ae6bb3d9785f7a3ba4a4c6c1b1af2" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "toggleterm.nvim": { "branch": "main", "commit": "50ea089fc548917cc3cc16b46a8211833b9e3c7c" }, "tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" }, diff --git a/lua/config/autocmds.lua b/lua/config/autocmds.lua index 45c52db..83a4875 100644 --- a/lua/config/autocmds.lua +++ b/lua/config/autocmds.lua @@ -114,3 +114,29 @@ autocmd("DirChanged", { end end, }) + +-- Golang AutoOpen PProf +autocmd("BufRead", { + pattern = { "cpu.out", "mem.out", "trace.out" }, + callback = function(args) + local name = vim.fn.fnamemodify(args.file, ":t") + vim.notify( + "Generated " .. name .. ". Use: `go tool pprof -http=:0 " .. name .. "` or `go tool trace " .. name .. "`", + vim.log.levels.INFO) + end, +}) + +-- SQL files +autocmd("FileType", { + pattern = { "sql", "mysql", "plsql" }, + callback = function() + local cmp = require("cmp") + cmp.setup.buffer({ + sources = { + { name = "vim-dadbod" }, + { name = "nvim_lsp" }, + { name = "buffer" }, + }, + }) + end, +}) diff --git a/lua/config/keymaps.lua b/lua/config/keymaps.lua index 09b1d6f..697c7e5 100644 --- a/lua/config/keymaps.lua +++ b/lua/config/keymaps.lua @@ -83,11 +83,17 @@ map("n", "tc", "Coverage", { desc = "Show coverage" }) -- Go benchmark map("n", "gb", function() - vim.cmd("!go test -bench . ./...") + vim.cmd("!go test -bench=. -benchmem ./...") end, { desc = "Go benchmarks" }) -map("n", "gp", function() - vim.cmd("!go test -cpuprofile cpu.out && go tool pprof cpu.out") +map("n", "gpc", function() + vim.cmd("!go test -run=^$ -bench=. -cpuprofile cpu.out ./...") end, { desc = "Go CPU profile" }) +map("n", "gpm", function() + vim.cmd("!go test -run=^$ -bench=. -memprofile mem.out ./...") +end, { desc = "Go memory profile" }) +map("n", "gpt", function() + vim.cmd("!go test -run=^$ -bench. -trace trace.out ./...") +end, { desc = "Go trace profile" }) -- Overseer map("n", "or", "OverseerRun", { desc = "Run task" }) @@ -102,3 +108,6 @@ map("n", "sc", vim.lsp.buf.outgoing_calls, { desc = "Outgoing calls" }) map("n", "xx", "Trouble diagnostics toggle") map("n", "xw", "Trouble workspace_diagnostics") map("n", "xt", "Trouble todo") + +-- Git Support +map("n", "gg", "Neogit", { desc = "Neogit"}) diff --git a/lua/overseer/template/user/go.lua b/lua/overseer/template/user/go.lua deleted file mode 100644 index 344ae57..0000000 --- a/lua/overseer/template/user/go.lua +++ /dev/null @@ -1,8 +0,0 @@ -return { - name = "go test", - builder = function() - return { - cmd = { "go", "test", "./..." }, - } - end, -} diff --git a/lua/overseer/template/user/go_bench.lua b/lua/overseer/template/user/go_bench.lua new file mode 100644 index 0000000..09d2eeb --- /dev/null +++ b/lua/overseer/template/user/go_bench.lua @@ -0,0 +1,15 @@ +return { + name = "go: benchmarks", + desc = "Run Go benchmarks with memory stats", + builder = function() + return { + cmd = { "go", "test" }, + args = { "-bench=.", "-benchmem", "./..." }, + components = { + "default", + "on_output_quickfix", + { "on_complete_notify", statuses = { "SUCCESS", "FAILURE" } }, + }, + } + end, +} diff --git a/lua/overseer/template/user/go_cpu_profile.lua b/lua/overseer/template/user/go_cpu_profile.lua new file mode 100644 index 0000000..fe8d1a2 --- /dev/null +++ b/lua/overseer/template/user/go_cpu_profile.lua @@ -0,0 +1,20 @@ +return { + name = "go: cpu profile", + desc = "Generate CPU profile (cpu.out)", + builder = function() + return { + cmd = { "go", "test" }, + args = { + "-run=^$", + "-bench=.", + "-cpuprofile=cpu.out", + "./...", + }, + components = { + "default", + "on_output_quickfix", + { "on_complete_notify", statuses = { "SUCCESS" } }, + }, + } + end, +} diff --git a/lua/overseer/template/user/go_mem_profile.lua b/lua/overseer/template/user/go_mem_profile.lua new file mode 100644 index 0000000..646431a --- /dev/null +++ b/lua/overseer/template/user/go_mem_profile.lua @@ -0,0 +1,20 @@ +return { + name = "go: mem profile", + desc = "Generate heap profile (mem.out)", + builder = function() + return { + cmd = { "go", "test" }, + args = { + "-run=^$", + "-bench=.", + "-memprofile=mem.out", + "./...", + }, + components = { + "default", + "on_output_quickfix", + { "on_complete_notify", statuses = { "SUCCESS" } }, + }, + } + end, +} diff --git a/lua/overseer/template/user/go_test.lua b/lua/overseer/template/user/go_test.lua new file mode 100644 index 0000000..e28fe8c --- /dev/null +++ b/lua/overseer/template/user/go_test.lua @@ -0,0 +1,10 @@ +return { + name = "go test", + desc = "Run all tests", + builder = function() + return { + cmd = { "go", "test" }, + args = { "./..." }, + } + end, +} diff --git a/lua/overseer/template/user/go_trace.lua b/lua/overseer/template/user/go_trace.lua new file mode 100644 index 0000000..b1c0443 --- /dev/null +++ b/lua/overseer/template/user/go_trace.lua @@ -0,0 +1,20 @@ +return { + name = "go: trace", + desc = "Generate execution trace (trace.out)", + builder = function() + return { + cmd = { "go", "test" }, + args = { + "-run=^$", + "-bench=.", + "-trace=trace.out", + "./...", + }, + components = { + "default", + "on_output_quickfix", + { "on_complete_notify", statuses = { "SUCCESS" } }, + }, + } + end, +} diff --git a/lua/plugins/dadbod.lua b/lua/plugins/dadbod.lua index dcf97cc..6876b9f 100644 --- a/lua/plugins/dadbod.lua +++ b/lua/plugins/dadbod.lua @@ -74,6 +74,7 @@ return { optional = true, dependencies = { "kristijanhusak/vim-dadbod-completion", + "nvim-cmp", }, opts = function(_, opts) opts.sources = opts.sources or {} diff --git a/lua/plugins/formatting.lua b/lua/plugins/formatting.lua index d1ccddb..1db03fb 100644 --- a/lua/plugins/formatting.lua +++ b/lua/plugins/formatting.lua @@ -46,9 +46,9 @@ return { ["markdown.mdx"] = { "prettier" }, -- SQL - sql = { "sql_formatter" }, - mysql = { "sql_formatter" }, - plsql = { "sql_formatter" }, + sql = { "sql_formatter", "sqlfluff", "pg_format" }, + mysql = { "sql_formatter", "sqlfluff" }, + plsql = { "sql_formatter", "sqlfluff", "pg_format" }, -- Makefile (no formatter - they require tabs) -- make = {}, diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua new file mode 100644 index 0000000..6c2c0e7 --- /dev/null +++ b/lua/plugins/git.lua @@ -0,0 +1,15 @@ +return { + { + "NeogitOrg/neogit", + dependencies = { + "nvim-lua/plenary.nvim", + "sindrets/diffview.nvim", + }, + cmd = "Neogit", + opts = { + integrations = { + diffview = true, + }, + }, + }, +} diff --git a/lua/plugins/go-profiling.lua b/lua/plugins/go-profiling.lua deleted file mode 100644 index 1014e0a..0000000 --- a/lua/plugins/go-profiling.lua +++ /dev/null @@ -1,10 +0,0 @@ -return { - { - "davecheney/profile", - ft = "go", - }, - { - "rbong/vim-flog", - cmd = { "Flog" }, - }, -} diff --git a/lua/plugins/neotest-python.lua b/lua/plugins/neotest-python.lua deleted file mode 100644 index 29e84b2..0000000 --- a/lua/plugins/neotest-python.lua +++ /dev/null @@ -1,6 +0,0 @@ -return { - { - "nvim-neotest/neotest-python", - dependencies = { "nvim-neotest/neotest" }, - }, -} diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua index cbcbbfe..2356d9c 100644 --- a/lua/plugins/neotest.lua +++ b/lua/plugins/neotest.lua @@ -5,15 +5,28 @@ return { "nvim-neotest/nvim-nio", "nvim-lua/plenary.nvim", "antoinemadec/FixCursorHold.nvim", + + -- Adapters "nvim-neotest/neotest-go", + "nvim-neotest/neotest-python", }, - opts = { - adapters = { - require("neotest-go"), - require("neotest-python")({ - dap = { justMyCode = false }, - }), - }, - }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-go")({ + experimental = { + test_table = true, + }, + args = { "-count=1", "-race" }, + }), + + require("neotest-python")({ + dap = { justMyCode = false }, + args = { "--disable-warnings", "-q" }, + }), + }, + }) + end, }, } + diff --git a/lua/plugins/overseer.lua b/lua/plugins/overseer.lua index 1ec04e7..979cf64 100644 --- a/lua/plugins/overseer.lua +++ b/lua/plugins/overseer.lua @@ -2,7 +2,7 @@ return { { "stevearc/overseer.nvim", opts = { - templates = { "builtin", "user.go", "user.npm" } + templates = { "builtin", "user" } }, }, }