A neovim plugin to show the heatmap of your Go project, for a bird eye view of the test coverage.
-- Packer
use { 'lordvidex/go-heat.nvim',
requires = { 'akinsho/toggleterm.nvim' },
config = function()
require('go-heat').setup()
end
}
Below are the default configurations. You can override them by passing a table to the setup function.
local configs = {
coverprofile = nil, -- default coverage profile (go-heat tries to look in cwd)
svg_output = '/tmp/go-heat/temp.svg', -- if not nil, will output the svg to this file
open_in = 'browser', -- 'terminal' | 'browser' (terminal has lower quality than browser)
browser_type = 'safari' -- only peculiar to Darwin; tested options: 'safari' | 'chrome' | 'arc'
debug = false, -- if true, will print debug messages
-- any option passed to browser_type must be executable with `open` -a <name> in macos
}
This plugin does not set any keymap and you can set your own keymap to call the show
function.
Below is an example of setting a keymap.
-- show the heatmap
vim.api.nvim_set_keymap('n', '<localleader>gth', '<cmd>lua require("go-heat").show()<cr>', { noremap = true, silent = true })
- go should be installed
- go-cover-treemap should be installed
- toggleterm should be installed (if opening in 'terminal')
- go cover treemap: A tool to generate treemap visualizations of Go cover profiles
- Add convenient plugs and probably keymaps
- Improve terminal render quality
- Add more options for go-cover-treemap e.g. package_only, colors, etc
- Reduce plugin dependencies / add scripts to install dependencies for all platforms
Please starπ this repository if you found go-heat useful.
Feel free to open an issue π or PR β if you have any suggestions or contributions.