https://github.com/mr-u0b0dy/crazy-coverage.nvim
Neovim plugin for displaying code coverage
https://github.com/mr-u0b0dy/crazy-coverage.nvim
coverage coverage-report nvim nvim-lua nvim-plugin
Last synced: 29 days ago
JSON representation
Neovim plugin for displaying code coverage
- Host: GitHub
- URL: https://github.com/mr-u0b0dy/crazy-coverage.nvim
- Owner: mr-u0b0dy
- License: apache-2.0
- Created: 2025-12-21T15:29:10.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-21T20:09:45.000Z (about 1 month ago)
- Last Synced: 2026-03-22T03:49:34.797Z (about 1 month ago)
- Topics: coverage, coverage-report, nvim, nvim-lua, nvim-plugin
- Language: Lua
- Homepage:
- Size: 718 KB
- Stars: 13
- Watchers: 0
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim-sorted - mr-u0b0dy/crazy-coverage.nvim
- awesome-neovim - mr-u0b0dy/crazy-coverage.nvim - Display code coverage. (Test / Quickfix)
README
# crazy-coverage.nvim
A Neovim plugin for displaying code coverage overlays directly in your editor with smart auto-loading and file watching.
## Features
- **Multi-Format Support**: LCOV, LLVM JSON, Cobertura XML, Go Coverprofile, GCOV, LLVM Profdata
- **Smart Toggle**: Single command auto-loads coverage and watches for changes
- **Flexible Display**: Show hit counts via virtual text or sign column
- **Branch/Region Overlays**: Inspect branch and LLVM region hit details at cursor
- **Tree Integration**: Coverage in NvimTree and neo-tree (optional)
- **Configurable**: Customize colors, display behavior, and summary popup
- **Navigation**: Jump between covered/uncovered/partial lines
## Demo
### Branch Coverage Overlay

### Coverage Summary

### Region Coverage Overlay

## Supported Languages
- **C/C++** - GCC (gcov/lcov), LLVM/Clang
- **Go** - Native `go test -coverprofile` (`coverage.out`)
- **Any Language** - Via LCOV, Cobertura XML, or LLVM JSON formats
The plugin supports any language that can generate coverage in one of the supported formats.
## Installation
### Using [lazy.nvim](https://github.com/folke/lazy.nvim)
```lua
{
"mr-u0b0dy/crazy-coverage.nvim",
config = function()
require("crazy-coverage").setup()
end,
}
```
### Using [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
"mr-u0b0dy/crazy-coverage.nvim",
config = function()
require("crazy-coverage").setup()
end,
}
```
See [Installation Guide](doc/installation.md) for other plugin managers and AstroVim setup.
## Quick Start
```lua
-- Toggle coverage (auto-loads file, watches for changes)
:CoverageToggle
-- Navigate uncovered code
]cu " Next uncovered line
[cu " Previous uncovered line
```
**What the toggle does:**
- Finds and loads coverage file automatically
- Enables overlay with line highlighting
- Watches file for changes (auto-reloads)
- Shows notifications on updates
- Cleans up everything when disabled
## Automatic Coverage File Discovery
The plugin intelligently finds your coverage file automatically. It:
1. **Searches Standard Directories** in order:
- `build/coverage/` - CMake build output
- `coverage/` - Standard coverage directory
- `build/` - Build directory root
- `.` - Project root
2. **Detects by Content** - Not just filenames:
- Finds LCOV files (even if not named `*.lcov`)
- Finds JSON coverage reports (even with custom names)
- Finds Cobertura XML files (regardless of filename)
- Finds Go coverprofile files (`coverage.out`)
- Finds GCOV/LLVM Profdata binary files
3. **Supports Any Filename**:
```
✓ build/coverage_report (no extension)
✓ coverage_2025_01_09.json (custom name)
✓ results.xml (non-standard name)
✓ my_coverage_data (any name works)
```
You can customize the search directories in config:
```lua
require("crazy-coverage").setup({
coverage_dirs = {
"build/coverage", -- Search here first
".coverage", -- Custom location
"coverage",
".",
}
})
```
See [Configuration Reference](doc/configuration.md#file-detection) for more details.
## Configuration
### Basic Setup
```lua
require("crazy-coverage").setup({
hit_count = {
show_by_default = true, -- Show hit counts when coverage is enabled
display = "eol", -- "eol", "inline", "overlay", "right_align", "sign"
},
auto_adapt_colors = true, -- Auto-adapt colors to your theme
})
```
### Common Configurations
```lua
-- Right-aligned with branch coverage
require("crazy-coverage").setup({
hit_count = {
display = "right_align",
},
show_branch_summary = true, -- Branch overlay header: taken/total + percentage
})
-- Custom colors (disable auto-adaptation)
require("crazy-coverage").setup({
auto_adapt_colors = false,
colors = {
covered = { bg = "#1a4d1a", fg = "#66ff66" },
uncovered = { bg = "#4d1a1a", fg = "#ff6666" },
partial = { bg = "#4d4d1a", fg = "#ffff66" },
},
})
-- Auto-adapt with one manual override
require("crazy-coverage").setup({
auto_adapt_colors = true, -- Adapt most colors
colors = {
uncovered = "#660000", -- But always use dark red for uncovered
},
})
```
Legacy options (`default_show_hit_count`, `show_hit_count`) are still supported for compatibility.
See [Configuration Reference](doc/configuration.md) for all 15+ options.
## Commands
| Command | Description |
|---------|-------------|
| `:CoverageToggle` | Toggle coverage overlay (auto-loads, watches file) |
| `:CoverageToggleHitCount` | Toggle hit count display |
| `:CoverageToggleBranchOverlay` | Toggle branch overlay at cursor |
| `:CoverageToggleRegionOverlay` | Toggle LLVM region overlay at cursor |
| `:CoverageToggleNvimTree` | Toggle coverage display in NvimTree |
| `:CoverageToggleNeoTree` | Toggle coverage display in neo-tree |
| `:CoverageLoad ` | Manually load specific coverage file |
| `:CoverageSummary ` | Show coverage summary popup (alias: `:CrazyCoverageSummary`) |
| `:CoverageNextCovered` | Jump to next covered line |
| `:CoveragePrevCovered` | Jump to previous covered line |
| `:CoverageNextUncovered` | Jump to next uncovered line |
| `:CoveragePrevUncovered` | Jump to previous uncovered line |
| `:CoverageNextPartial` | Jump to next partially covered line |
| `:CoveragePrevPartial` | Jump to previous partially covered line |
See [Usage Guide](doc/usage.md) for keybindings and navigation.
## Documentation
- **[Installation Guide](doc/installation.md)** - Plugin managers and AstroVim setup
- **[Usage Guide](doc/usage.md)** - Commands, keybindings, and workflows
- **[Configuration Reference](doc/configuration.md)** - All config options
- **[Supported Formats](doc/formats.md)** - Coverage format details
- **[Coverage Examples](coverage-examples/)** - C/C++/Go examples with GCC/LLVM/Go tools
- **[Architecture](doc/architecture.md)** - Plugin design guide
- **[Development](doc/development.md)** - Testing and contributing
## Requirements
- Neovim 0.7+
- Coverage files from your build system (lcov, llvm-cov, etc.)
## License
Apache License 2.0 - Copyright © 2026 mr-u0b0dy
## Contributing
See [Development Guide](doc/development.md) for testing and contribution guidelines.