1
0
Fork 0
No description
Find a file
2026-07-24 20:45:31 +03:00
lua/go-tags init 2026-07-24 20:45:31 +03:00
plugin init 2026-07-24 20:45:31 +03:00
README.md init 2026-07-24 20:45:31 +03:00

Simple go build tags picker for nvim

Lazy.nvim

return {
    'https://git.wzray.com/wzray/go-tags.nvim'
    config = function()
        vim.api.nvim_create_autocmd('FileType', {
            pattern = 'go',
            callback = function(args)
                vim.keymap.set('n', '<leader>t', require('go-tags').pick_build_tags, { buf = args.buf })
                vim.keymap.set('n', '<leader>T', require('go-tags').enter_build_tags, { buf = args.buf })
            end,
        })

        -- be sure to load lsp configs BEFORE plugins
        local current_tags = require('go-tags').load_build_tags()
        if current_tags then
            vim.lsp.config.gopls.settings.buildFlags = { '-tags=' .. current_tags }
        end
    end
}