From 63d47278710d05404a2411cd7074ce8ac53241bf Mon Sep 17 00:00:00 2001 From: Donovan Date: Sun, 4 May 2025 06:08:52 -0500 Subject: [PATCH] add neotest --- lazy-lock.json | 11 +++--- lua/dkelly/plugins/comment.lua | 31 ++++++++--------- lua/dkelly/plugins/dap.lua | 1 + lua/dkelly/plugins/linter.lua | 2 +- lua/dkelly/plugins/neotest.lua | 42 +++++++++++++++++++++++ lua/dkelly/plugins/nvim-tree.lua | 57 ++++++++++++++++++-------------- 6 files changed, 100 insertions(+), 44 deletions(-) create mode 100644 lua/dkelly/plugins/neotest.lua diff --git a/lazy-lock.json b/lazy-lock.json index 81f4277..8ebce68 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -12,7 +12,7 @@ "conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" }, "copilot.lua": { "branch": "master", "commit": "a5c390f8d8e85b501b22dcb2f30e0cbbd69d5ff0" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "gitsigns.nvim": { "branch": "main", "commit": "fd50977fce4d5240b910d2b816e71fb726cbbaf7" }, + "gitsigns.nvim": { "branch": "main", "commit": "1796c7cedfe7e5dd20096c5d7b8b753d8f8d22eb" }, "lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" }, "lazygit.nvim": { "branch": "main", "commit": "b9eae3badab982e71abab96d3ee1d258f0c07961" }, "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, @@ -21,6 +21,9 @@ "mason-tool-installer.nvim": { "branch": "main", "commit": "1255518cb067e038a4755f5cb3e980f79b6ab89c" }, "mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" }, "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "neotest": { "branch": "master", "commit": "6267dcd577aa519c828d2526b05844770d3a2c6a" }, + "neotest-go": { "branch": "main", "commit": "92950ad7be2ca02a41abca5c6600ff6ffaf5b5d6" }, + "neotest-python": { "branch": "master", "commit": "a2861ab3c9a0bf75a56b11835c2bfc8270f5be7e" }, "nvim-autopairs": { "branch": "master", "commit": "4d74e75913832866aa7de35e4202463ddf6efd1b" }, "nvim-cmp": { "branch": "main", "commit": "b5311ab3ed9c846b585c0c15b7559be131ec4be9" }, "nvim-dap": { "branch": "master", "commit": "8df427aeba0a06c6577dc3ab82de3076964e3b8d" }, @@ -30,13 +33,13 @@ "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lint": { "branch": "master", "commit": "9dfb77ef6c5092a19502883c02dc5a02ec648729" }, "nvim-lsp-file-operations": { "branch": "master", "commit": "9744b738183a5adca0f916527922078a965515ed" }, - "nvim-lspconfig": { "branch": "master", "commit": "37cc31c64d657feff6f752a1bf15f584d4734eca" }, + "nvim-lspconfig": { "branch": "master", "commit": "46434074f188e6bfccf9d9153dd8be6b1381498b" }, "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-tree.lua": { "branch": "master", "commit": "582ae48c9e43d2bcd55dfcc8e2e7a1f29065d924" }, - "nvim-treesitter": { "branch": "master", "commit": "3b308861a8d7d7bfbe9be51d52e54dcfd9fe3d38" }, + "nvim-treesitter": { "branch": "master", "commit": "94ea4f436d2b59c80f02e293466c374584f03b8c" }, "nvim-ts-autotag": { "branch": "main", "commit": "a1d526af391f6aebb25a8795cbc05351ed3620b5" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, - "nvim-web-devicons": { "branch": "master", "commit": "50b5b06bff13a9b4eab946de7c7033649a6618a1" }, + "nvim-web-devicons": { "branch": "master", "commit": "2c2b4eafce6cdd0cb165036faa17396eff18f847" }, "plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" }, "telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }, diff --git a/lua/dkelly/plugins/comment.lua b/lua/dkelly/plugins/comment.lua index ecc93c4..44f8fa9 100644 --- a/lua/dkelly/plugins/comment.lua +++ b/lua/dkelly/plugins/comment.lua @@ -1,19 +1,20 @@ return { - "numToStr/Comment.nvim", - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "JoosepAlviste/nvim-ts-context-commentstring", - }, - config = function() - -- import comment plugin safely - local comment = require("Comment") + "numToStr/Comment.nvim", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "JoosepAlviste/nvim-ts-context-commentstring", + }, + -- default comment gcc and gc + config = function() + -- import comment plugin safely + local comment = require("Comment") - local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") + local ts_context_commentstring = require("ts_context_commentstring.integrations.comment_nvim") - -- enable comment - comment.setup({ - -- for commenting tsx, jsx, svelte, html files - pre_hook = ts_context_commentstring.create_pre_hook(), - }) - end, + -- enable comment + comment.setup({ + -- for commenting tsx, jsx, svelte, html files + pre_hook = ts_context_commentstring.create_pre_hook(), + }) + end, } diff --git a/lua/dkelly/plugins/dap.lua b/lua/dkelly/plugins/dap.lua index a0a8819..3698838 100644 --- a/lua/dkelly/plugins/dap.lua +++ b/lua/dkelly/plugins/dap.lua @@ -34,6 +34,7 @@ return { vim.keymap.set("n", "b5", dap.step_back, { desc = "Step back" }) vim.keymap.set("n", "b6", dap.restart, { desc = "Restart" }) + dap.configurations.go = {} dap.listeners.before.attach.dapui_config = function() ui.open() end diff --git a/lua/dkelly/plugins/linter.lua b/lua/dkelly/plugins/linter.lua index 83ce090..52b4f9e 100644 --- a/lua/dkelly/plugins/linter.lua +++ b/lua/dkelly/plugins/linter.lua @@ -11,7 +11,7 @@ return { typescriptreact = { "eslint_d" }, svelte = { "eslint_d" }, python = { "pylint" }, - go = { "golangci-lint" }, + go = { "golangcilint" }, } local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) diff --git a/lua/dkelly/plugins/neotest.lua b/lua/dkelly/plugins/neotest.lua new file mode 100644 index 0000000..728a95a --- /dev/null +++ b/lua/dkelly/plugins/neotest.lua @@ -0,0 +1,42 @@ +-- ~/.config/nvim/lua/plugins/neotest.lua +return { + { + "nvim-neotest/neotest", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-treesitter/nvim-treesitter", + "nvim-neotest/neotest-go", + "nvim-neotest/neotest-python", + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-python")({ + dap = { justMyCode = false }, + }), + require("neotest-go")({}), + }, + icons = { + running = "", + passed = "", + failed = "", + skipped = "", + }, + output = { + enabled = true, + open_on_run = true, + open = "botright split | resize 15", + }, + }) + + local map = vim.keymap.set + map("n", "tr", require("neotest").run.run, { desc = "Run nearest test" }) + map("n", "tF", function() + require("neotest").run.run(vim.fn.expand("%")) + end, { desc = "Run tests in file" }) + map("n", "ts", require("neotest").run.stop, { desc = "Stop test" }) + map("n", "to", require("neotest").output_panel.toggle, { desc = "Toggle test output" }) + map("n", "tS", require("neotest").summary.toggle, { desc = "Toggle test summary" }) + end, + }, +} diff --git a/lua/dkelly/plugins/nvim-tree.lua b/lua/dkelly/plugins/nvim-tree.lua index afcd01a..ea7d0fa 100644 --- a/lua/dkelly/plugins/nvim-tree.lua +++ b/lua/dkelly/plugins/nvim-tree.lua @@ -1,26 +1,35 @@ return { - "nvim-tree/nvim-tree.lua", - dependencies = { - "nvim-tree/nvim-web-devicons", - }, - config = function() - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - require("nvim-tree").setup({ - view = { - width = 35, - relativenumber = true, - }, - renderer = { - indent_markers = { - enable = true, - }, - }, - }) - local keymap = vim.keymap - keymap.set("n", "ee", "NvimTreeToggle", { desc = "Toggle file explorer" }) - keymap.set("n", "ef", "NvimTreeFindFileToggle", { desc = "Toggle file explorer on current buffer" }) - keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) - keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) - end, + "nvim-tree/nvim-tree.lua", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + require("nvim-tree").setup({ + view = { + width = 35, + relativenumber = true, + }, + renderer = { + indent_markers = { + enable = true, + }, + }, + filters = { + dotfiles = false, + git_ignored = false, + }, + }) + local keymap = vim.keymap + keymap.set("n", "ee", "NvimTreeToggle", { desc = "Toggle file explorer" }) + keymap.set( + "n", + "ef", + "NvimTreeFindFileToggle", + { desc = "Toggle file explorer on current buffer" } + ) + keymap.set("n", "ec", "NvimTreeCollapse", { desc = "Collapse file explorer" }) + keymap.set("n", "er", "NvimTreeRefresh", { desc = "Refresh file explorer" }) + end, }