-
-
Notifications
You must be signed in to change notification settings - Fork 252
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nvim-coverage): add keybindings (#1186)
* feat(nvim-coverage): add keybindings * feat(nvim-coverage): auto reload the coverage report
- Loading branch information
1 parent
bfbbe67
commit 07ff0d8
Showing
1 changed file
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,44 @@ | ||
---@type LazySpec | ||
return { | ||
"andythigpen/nvim-coverage", | ||
event = "User AstroFile", | ||
dependencies = { "nvim-lua/plenary.nvim" }, | ||
opts = {}, | ||
opts = { | ||
auto_reload = true, | ||
}, | ||
dependencies = { | ||
"nvim-lua/plenary.nvim", | ||
{ | ||
"AstroNvim/astroui", | ||
opts = { | ||
icons = { | ||
Tests = "", | ||
Coverage = "", | ||
}, | ||
}, | ||
}, | ||
{ | ||
"AstroNvim/astrocore", | ||
optional = true, | ||
opts = function(_, opts) | ||
local astroui = require "astroui" | ||
local maps = opts.mappings | ||
|
||
local tests_prefix = "<Leader>T" | ||
local coverage_prefix = tests_prefix .. "C" | ||
|
||
-- INFO: Compatibility with `neotest` and `vim-test` | ||
maps.n[tests_prefix] = { desc = astroui.get_icon("Tests", 1, true) .. "Tests" } | ||
|
||
maps.n[coverage_prefix] = { desc = astroui.get_icon("Coverage", 1, true) .. "Coverage" } | ||
maps.n[coverage_prefix .. "t"] = { function() require("coverage").toggle() end, desc = "Toggle coverage" } | ||
maps.n[coverage_prefix .. "s"] = | ||
{ function() require("coverage").summary() end, desc = "Show coverage summary" } | ||
maps.n[coverage_prefix .. "c"] = { function() require("coverage").clear() end, desc = "Clear coverage" } | ||
maps.n[coverage_prefix .. "l"] = { | ||
function() require("coverage").load(true) end, | ||
desc = "Load and show coverage", | ||
} | ||
end, | ||
}, | ||
}, | ||
} |