Skip to content

Snikimonkd/cmp-go-pkgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cmp-go-pkgs

nvim-cmp source for golang packages path.

Loads once on LspAttach event.

Shows only inside import block.

example2.mov

Setup

Setup with lazy.nvim:

return {
    "hrsh7th/nvim-cmp",
    dependencies = {
        "Snikimonkd/cmp-go-pkgs",
    },
    config = function()
        local cmp = require("cmp")

        cmp.setup({
            sources = {
                { name = "go_pkgs" },
            },
			matching = { disallow_symbol_nonprefix_matching = false }, -- to use . and / in urls
        })
    end,
},

Lspkind

You can use it with lspkind:

return {
    "hrsh7th/nvim-cmp",
    dependencies = {
        "Snikimonkd/cmp-go-pkgs",
    },
    config = function()
        local cmp = require("cmp")
        local lspkind = require("lspkind")

        cmp.setup({
            sources = {
                { name = "go_pkgs" },
            },
            formatting = {
                format = lspkind.cmp_format({
                    with_text = true,
                    menu = {
                        go_pkgs = "[pkgs]",
                    },
                }),
            },
        })
    end,
},

Inspiration

(where i stole some code)

https://github.com/ray-x/go.nvim

https://github.com/hrsh7th/cmp-buffer

https://github.com/onsails/lspkind.nvim

Releases

No releases published

Packages

No packages published

Languages