Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nvim-coverage): add keybindings #1186

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions lua/astrocommunity/test/nvim-coverage/init.lua
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,
},
},
}
Loading