You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- if set, when we switch between buffers, it will not split more than once. It will switch to the existing buffer insteadvim.opt.switchbuf='useopen'localgoc=require'nvim-goc'goc.setup({ verticalSplit=false }) -- default to horizontalvim.keymap.set('n', '<Leader>gcf', goc.Coverage, {silent=true}) -- run for the whole Filevim.keymap.set('n', '<Leader>gct', goc.CoverageFunc, {silent=true}) -- run only for a specific Test unitvim.keymap.set('n', '<Leader>gcc', goc.ClearCoverage, {silent=true}) -- clear coverage highlights-- If you need custom arguments, you can supply an array as in the example below.-- vim.keymap.set('n', '<Leader>gcf', function() goc.Coverage({ "-race", "-count=1" }) end, {silent=true})-- vim.keymap.set('n', '<Leader>gct', function() goc.CoverageFunc({ "-race", "-count=1" }) end, {silent=true})vim.keymap.set('n', ']a', goc.Alternate, {silent=true})
vim.keymap.set('n', '[a', goc.AlternateSplit, {silent=true}) -- set verticalSplit=true for verticalcf=function(testCurrentFunction)
localcb=function(path, index)
ifpaththen-- `xdg-open|open` command performs the same function as double-clicking on the file.-- change from `xdg-open` to `open` on MacOSxvim.cmd(":silent exec \"!xdg-open file://" ..path.."\\\\#file" ..index.."\"")
endendiftestCurrentFunctionthengoc.CoverageFunc(nil, cb, 0)
elsegoc.Coverage(nil, cb)
endend-- If you want to open it in your browser, you can use the commands below.-- You need to create a callback function to configure which command to use to open the HTML.-- On Linux, `xdg-open` is generally used, on MacOSx it's just `open`.vim.keymap.set('n', '<leader>gca', cf, {silent=true})
vim.keymap.set('n', '<Leader>gcb', function() cf(true) end, {silent=true})
-- default colors-- vim.api.nvim_set_hl(0, 'GocNormal', {link='Comment'})-- vim.api.nvim_set_hl(0, 'GocCovered', {link='String'})-- vim.api.nvim_set_hl(0, 'GocUncovered', {link='Error'})